fix: user profile avatar + loading spinners + modal opacity
- UserProfile now uses avatar_url (was always default ui-avatars) - Loading states show spinner-sm spinner instead of plain text (Feed, UserProfile, chat, admin panels, custom pages) - Modal background: semi-transparent glass (0.85 light / 0.88 dark)
This commit is contained in:
1 parent
bfe8a80822
commit
74202f7551
10 files changed
+30
-11
No files matched your search
+20
-1
@@ -32,6 +32,7 @@
|
||||
|
||||
/* ===== 兼容旧变量(React 组件内联样式使用)===== */
|
||||
--bg: #dfe6e9;
|
||||
--modal-bg: rgba(255, 255, 255, 0.85); /* 弹窗背景:半透明玻璃感但保证可读性 */
|
||||
--surface: rgba(255, 255, 255, 0.18);
|
||||
--border: rgba(255, 255, 255, 0.30);
|
||||
--border-light: rgba(255, 255, 255, 0.12);
|
||||
@@ -72,6 +73,7 @@
|
||||
|
||||
/* ===== 兼容旧变量(React 组件内联样式使用)===== */
|
||||
--bg: #0f0f1a;
|
||||
--modal-bg: rgba(24, 24, 38, 0.88); /* 弹窗背景:半透明玻璃感但保证可读性 */
|
||||
--surface: rgba(30, 30, 50, 0.35);
|
||||
--border: rgba(255, 255, 255, 0.10);
|
||||
--border-light: rgba(255, 255, 255, 0.06);
|
||||
@@ -622,7 +624,7 @@ svg {
|
||||
}
|
||||
}
|
||||
.modal-content {
|
||||
background: var(--glass-bg);
|
||||
background: var(--modal-bg, var(--glass-bg));
|
||||
backdrop-filter: blur(32px);
|
||||
-webkit-backdrop-filter: blur(32px);
|
||||
border: 1px solid var(--glass-border);
|
||||
@@ -2286,3 +2288,20 @@ a.btn-secondary {
|
||||
color: var(--glass-text) !important;
|
||||
border-color: var(--glass-border) !important;
|
||||
}
|
||||
|
||||
/* ===== 小转圈(列表/局部加载) ===== */
|
||||
.spinner-sm {
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 2px solid var(--glass-border);
|
||||
border-top-color: var(--primary);
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
vertical-align: -3px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export default function CustomPage({ pageName }) {
|
||||
);
|
||||
}
|
||||
if (html === null) {
|
||||
return <div style={{ padding: '84px 32px', textAlign: 'center', color: '#94a3b8' }}>加载中...</div>;
|
||||
return <div style={{ padding: '84px 32px', textAlign: 'center', color: '#94a3b8' }}><span className="spinner-sm" />加载中...</div>;
|
||||
}
|
||||
|
||||
const srcdoc = `<!DOCTYPE html>
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ export default function Feed({ onOpenModal, onReport }) {
|
||||
</div>
|
||||
<div id="postList" ref={postListRef}>
|
||||
{posts === null ? (
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}>加载中...</div>
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}><span className="spinner-sm" />加载中...</div>
|
||||
) : error ? (
|
||||
<div style={{ textAlign: 'center', color: '#ef4444', padding: '40px 0' }}>加载失败:{error}</div>
|
||||
) : posts.length === 0 ? (
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function UserProfile({ username }) {
|
||||
);
|
||||
}
|
||||
if (!user) {
|
||||
return <div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}>加载中...</div>;
|
||||
return <div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}><span className="spinner-sm" />加载中...</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -55,7 +55,7 @@ export default function UserProfile({ username }) {
|
||||
</div>
|
||||
<div style={{ maxWidth: 700, margin: '0 auto', width: '100%' }}>
|
||||
<div style={{ background: 'var(--surface)', border: '1px solid var(--border)', borderRadius: 8, padding: 32, textAlign: 'center' }}>
|
||||
<img src={avatar(user.username)} style={{ width: 96, height: 96, borderRadius: '50%', objectFit: 'cover', border: '3px solid var(--primary)' }} alt="" />
|
||||
<img src={user.avatar_url || avatar(user.username)} style={{ width: 96, height: 96, borderRadius: '50%', objectFit: 'cover', border: '3px solid var(--primary)' }} alt="" />
|
||||
<h2 style={{ margin: '16px 0 4px', fontSize: 24 }}>{user.username}</h2>
|
||||
<p style={{ color: 'var(--text-secondary)', fontSize: 14 }}>{user.bio || '这个人很懒,什么都没写'}</p>
|
||||
{currentUser && currentUser.id !== user.id && (
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function AdminCustomPages() {
|
||||
</div>
|
||||
<div id="customPageList">
|
||||
{pages === null ? (
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: 20 }}>加载中...</div>
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: 20 }}><span className="spinner-sm" />加载中...</div>
|
||||
) : pages.length === 0 ? (
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: 20 }}>暂无自定义页面</div>
|
||||
) : (
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function AdminLogs() {
|
||||
useEffect(load, []);
|
||||
|
||||
if (error) return <div style={{ textAlign: 'center', color: '#ef4444', padding: 20 }}>加载失败:{error}</div>;
|
||||
if (!logs) return <div style={{ textAlign: 'center', color: '#94a3b8', padding: 20 }}>加载中...</div>;
|
||||
if (!logs) return <div style={{ textAlign: 'center', color: '#94a3b8', padding: 20 }}><span className="spinner-sm" />加载中...</div>;
|
||||
if (logs.length === 0) return <div style={{ textAlign: 'center', color: '#94a3b8', padding: 40 }}>暂无日志</div>;
|
||||
|
||||
return (
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function AdminReports() {
|
||||
};
|
||||
|
||||
if (error) return <div style={{ textAlign: 'center', color: '#ef4444', padding: 20 }}>加载失败:{error}</div>;
|
||||
if (!reports) return <div style={{ textAlign: 'center', color: '#94a3b8', padding: 20 }}>加载中...</div>;
|
||||
if (!reports) return <div style={{ textAlign: 'center', color: '#94a3b8', padding: 20 }}><span className="spinner-sm" />加载中...</div>;
|
||||
if (reports.length === 0) return <div style={{ textAlign: 'center', color: '#94a3b8', padding: 40 }}>✅ 暂无举报</div>;
|
||||
|
||||
return reports.map((r) => (
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function AdminUsers() {
|
||||
};
|
||||
|
||||
if (error) return <div style={{ textAlign: 'center', color: '#ef4444', padding: 20 }}>加载失败:{error}</div>;
|
||||
if (!users) return <div style={{ textAlign: 'center', color: '#94a3b8', padding: 20 }}>加载中...</div>;
|
||||
if (!users) return <div style={{ textAlign: 'center', color: '#94a3b8', padding: 20 }}><span className="spinner-sm" />加载中...</div>;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -60,7 +60,7 @@ export default function ChatWindow({ conversationId, otherUserId, otherUsername,
|
||||
</div>
|
||||
<div id="chatMessages" ref={containerRef} style={{ flex: 1, overflowY: 'auto', padding: 16, minHeight: 0 }}>
|
||||
{messages === null ? (
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}>加载中...</div>
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}><span className="spinner-sm" />加载中...</div>
|
||||
) : messages.length === 0 ? (
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}>还没有消息,打个招呼吧 👋</div>
|
||||
) : (
|
||||
|
||||
@@ -29,7 +29,7 @@ export default function ConversationList({ onOpenChat, onClose }) {
|
||||
</div>
|
||||
<div id="messageListContent" style={{ flex: 1, overflowY: 'auto', padding: 0 }}>
|
||||
{conversations === null ? (
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}>加载中...</div>
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}><span className="spinner-sm" />加载中...</div>
|
||||
) : conversations.length === 0 ? (
|
||||
<div style={{ textAlign: 'center', color: '#94a3b8', padding: '40px 0' }}>暂无私信</div>
|
||||
) : (
|
||||
|
||||
Reference in new issue
Block a user