Spaces:
Running
Running
Upload 2 files
Browse files- 前端页面/components/顶部导航组件.js +13 -3
- 前端页面/styles/主题基础.css +3 -2
前端页面/components/顶部导航组件.js
CHANGED
|
@@ -9,7 +9,7 @@ import { openNotificationCenter, loadUnreadCount } from "../social/通知中心
|
|
| 9 |
import { openSettingsPage } from "./全局设置组件.js"; // ⚙️ 新增
|
| 10 |
import { setUser, updateUser, initUserState } from "../core/状态管理.js";
|
| 11 |
import { readUserSession, sessionProfile } from "../core/用户会话存储.js";
|
| 12 |
-
import { API, CACHE,
|
| 13 |
import { t } from "./用户体验增强.js"; // 🌐 多语言支持
|
| 14 |
import { createTopBanner } from "./顶部广告组件.js";
|
| 15 |
import { uploadFile } from "../market/发布内容_提交引擎.js"; // 🖼️ 带压缩管线的统一上传包装器
|
|
@@ -92,9 +92,18 @@ export function createTopNav() {
|
|
| 92 |
|
| 93 |
const updateUserButtonState = () => {
|
| 94 |
if (currentUser) {
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
userActionBtn.dataset.authenticated = "true";
|
| 97 |
-
userActionBtn.title =
|
| 98 |
userActionBtn.onclick = () => openUserProfileModal(currentUser);
|
| 99 |
loadUnreadCount(currentUser, bellBtn);
|
| 100 |
loadChatUnreadCount(currentUser, chatEntryBtn);
|
|
@@ -108,6 +117,7 @@ export function createTopNav() {
|
|
| 108 |
userActionBtn.innerHTML = `🔑 ${t('nav.login')}`;
|
| 109 |
userActionBtn.dataset.authenticated = "false";
|
| 110 |
userActionBtn.title = t('nav.login');
|
|
|
|
| 111 |
bellBtn.querySelector("#unread-badge").style.display = "none";
|
| 112 |
chatEntryBtn.querySelector("#chat-unread-badge").style.display = "none";
|
| 113 |
|
|
|
|
| 9 |
import { openSettingsPage } from "./全局设置组件.js"; // ⚙️ 新增
|
| 10 |
import { setUser, updateUser, initUserState } from "../core/状态管理.js";
|
| 11 |
import { readUserSession, sessionProfile } from "../core/用户会话存储.js";
|
| 12 |
+
import { API, CACHE, PLACEHOLDERS } from "../core/全局配置.js";
|
| 13 |
import { t } from "./用户体验增强.js"; // 🌐 多语言支持
|
| 14 |
import { createTopBanner } from "./顶部广告组件.js";
|
| 15 |
import { uploadFile } from "../market/发布内容_提交引擎.js"; // 🖼️ 带压缩管线的统一上传包装器
|
|
|
|
| 92 |
|
| 93 |
const updateUserButtonState = () => {
|
| 94 |
if (currentUser) {
|
| 95 |
+
const avatar = document.createElement("img");
|
| 96 |
+
avatar.className = "top-nav__avatar";
|
| 97 |
+
avatar.alt = "";
|
| 98 |
+
avatar.src = currentUser.avatarDataUrl || currentUser.avatar || PLACEHOLDERS.AVATAR_SMALL;
|
| 99 |
+
avatar.onerror = () => {
|
| 100 |
+
avatar.onerror = null;
|
| 101 |
+
avatar.src = PLACEHOLDERS.AVATAR_SMALL;
|
| 102 |
+
};
|
| 103 |
+
userActionBtn.replaceChildren(avatar);
|
| 104 |
+
userActionBtn.setAttribute("aria-label", t('nav.profile'));
|
| 105 |
userActionBtn.dataset.authenticated = "true";
|
| 106 |
+
userActionBtn.title = t('nav.profile');
|
| 107 |
userActionBtn.onclick = () => openUserProfileModal(currentUser);
|
| 108 |
loadUnreadCount(currentUser, bellBtn);
|
| 109 |
loadChatUnreadCount(currentUser, chatEntryBtn);
|
|
|
|
| 117 |
userActionBtn.innerHTML = `🔑 ${t('nav.login')}`;
|
| 118 |
userActionBtn.dataset.authenticated = "false";
|
| 119 |
userActionBtn.title = t('nav.login');
|
| 120 |
+
userActionBtn.setAttribute("aria-label", t('nav.login'));
|
| 121 |
bellBtn.querySelector("#unread-badge").style.display = "none";
|
| 122 |
chatEntryBtn.querySelector("#chat-unread-badge").style.display = "none";
|
| 123 |
|
前端页面/styles/主题基础.css
CHANGED
|
@@ -343,7 +343,9 @@
|
|
| 343 |
.comfy-ranking-root .top-nav__actions { display: flex; align-items: center; gap: 8px; flex: 1 1 210px; min-width: 0; }
|
| 344 |
.comfy-ranking-root .top-nav__icon { position: relative; flex: 0 0 36px; width: 36px; height: 36px; padding: 4px; box-sizing: border-box; border: 1px solid transparent; border-radius: var(--rk-radius-sm); background: transparent; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
|
| 345 |
.comfy-ranking-root .top-nav__identity { flex: 1 1 auto; min-width: 0; min-height: 36px; padding: 6px 12px; box-sizing: border-box; border: 1px solid var(--rk-border); border-radius: var(--rk-radius-sm); background: var(--rk-panel); color: var(--rk-text); font: inherit; font-size: 12px; line-height: 1.4; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
| 346 |
-
.comfy-ranking-root .top-nav__identity[data-authenticated="true"] {
|
|
|
|
|
|
|
| 347 |
.comfy-ranking-root .top-nav__badge { position: absolute; top: -2px; right: -3px; padding: 2px 5px; border-radius: 10px; background: #c62828; color: #fff; font-size: 10px; font-weight: bold; line-height: 1; }
|
| 348 |
.comfy-ranking-root .top-nav button:focus-visible { outline: 2px solid var(--rk-focus); outline-offset: 2px; }
|
| 349 |
@media (hover: hover) { .comfy-ranking-root .top-nav__icon:hover, .comfy-ranking-root .top-nav__identity:hover { border-color: var(--rk-focus); } .comfy-ranking-root .top-nav__brand:hover { opacity: .85; } }
|
|
@@ -1233,7 +1235,6 @@
|
|
| 1233 |
.notification-system-name { font-size: 15px; }
|
| 1234 |
.notif-item-link, .notif-user-link { display: inline; padding: 2px 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; overflow-wrap: anywhere; max-width: 100%; }
|
| 1235 |
.notif-user-link { font-weight: bold; }
|
| 1236 |
-
.notification-primary { margin-top: 8px; min-width: 36px; min-height: 36px; padding: 4px 10px; border: 1px solid var(--rk-border, #555); border-radius: 6px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
|
| 1237 |
.notification-view button:focus-visible { outline: 2px solid var(--rk-focus, var(--fg-color, #8ab4ff)); outline-offset: 3px; }
|
| 1238 |
@media (max-width: 480px) { .notification-view { padding: 10px; } .notif-item { gap: 8px; padding: 10px; } }
|
| 1239 |
|
|
|
|
| 343 |
.comfy-ranking-root .top-nav__actions { display: flex; align-items: center; gap: 8px; flex: 1 1 210px; min-width: 0; }
|
| 344 |
.comfy-ranking-root .top-nav__icon { position: relative; flex: 0 0 36px; width: 36px; height: 36px; padding: 4px; box-sizing: border-box; border: 1px solid transparent; border-radius: var(--rk-radius-sm); background: transparent; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
|
| 345 |
.comfy-ranking-root .top-nav__identity { flex: 1 1 auto; min-width: 0; min-height: 36px; padding: 6px 12px; box-sizing: border-box; border: 1px solid var(--rk-border); border-radius: var(--rk-radius-sm); background: var(--rk-panel); color: var(--rk-text); font: inherit; font-size: 12px; line-height: 1.4; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
| 346 |
+
.comfy-ranking-root .top-nav__actions:has(.top-nav__identity[data-authenticated="true"]) { flex: 0 0 auto; margin-inline-start: auto; }
|
| 347 |
+
.comfy-ranking-root .top-nav__identity[data-authenticated="true"] { flex: 0 0 50px; width: 50px; height: 50px; padding: 0; border: 2px solid var(--rk-border); border-radius: 50%; }
|
| 348 |
+
.comfy-ranking-root .top-nav__avatar { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
|
| 349 |
.comfy-ranking-root .top-nav__badge { position: absolute; top: -2px; right: -3px; padding: 2px 5px; border-radius: 10px; background: #c62828; color: #fff; font-size: 10px; font-weight: bold; line-height: 1; }
|
| 350 |
.comfy-ranking-root .top-nav button:focus-visible { outline: 2px solid var(--rk-focus); outline-offset: 2px; }
|
| 351 |
@media (hover: hover) { .comfy-ranking-root .top-nav__icon:hover, .comfy-ranking-root .top-nav__identity:hover { border-color: var(--rk-focus); } .comfy-ranking-root .top-nav__brand:hover { opacity: .85; } }
|
|
|
|
| 1235 |
.notification-system-name { font-size: 15px; }
|
| 1236 |
.notif-item-link, .notif-user-link { display: inline; padding: 2px 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; overflow-wrap: anywhere; max-width: 100%; }
|
| 1237 |
.notif-user-link { font-weight: bold; }
|
|
|
|
| 1238 |
.notification-view button:focus-visible { outline: 2px solid var(--rk-focus, var(--fg-color, #8ab4ff)); outline-offset: 3px; }
|
| 1239 |
@media (max-width: 480px) { .notification-view { padding: 10px; } .notif-item { gap: 8px; padding: 10px; } }
|
| 1240 |
|