精修 WebUI 第十七轮:sticky 章节 / 语义着色 / 搜索计数 / 空状态升级
- sectionTitle 改 sticky 在长 panel 内吸附顶部,背景渐变 + 6px 模糊;cardTitle/summary 不变 - 福袋统计语义着色:参与成功/中奖 → success;失败 → error;未中奖 → muted;通过 .stateOk/.stateError/.stateWarn/.stateMuted 类切换 - 配置搜索右侧加实时匹配计数徽章("X 项");搜索清空时隐藏 - 空状态占位升级:从单色边框圆点 → 28px 聊天泡 SVG icon (currentColor mask) + 双行布局,更显设计 - cache-bust v19 → v20
This commit is contained in:
1 parent
51d8d53a2b
commit
632951d004
3 files changed
+67
-10
No files matched your search
@@ -334,6 +334,7 @@ function initConfigSearch() {
|
||||
const apply = (q) => {
|
||||
const query = q.trim().toLowerCase();
|
||||
if (clear) clear.toggleAttribute("hidden", !query);
|
||||
const countBadge = document.getElementById("configSearchCount");
|
||||
|
||||
if (!query) {
|
||||
// Restore all
|
||||
@@ -341,6 +342,7 @@ function initConfigSearch() {
|
||||
allSectionTitles.forEach((s) => s.classList.remove("isSearchHidden"));
|
||||
document.querySelectorAll(".panel").forEach((p) => p.classList.remove("isSearchAllHidden"));
|
||||
if (empty) empty.hidden = true;
|
||||
if (countBadge) countBadge.hidden = true;
|
||||
// Re-apply normal tab visibility (panels may have been forced visible)
|
||||
const activeTab = document.querySelector(".tabBtn.active[data-target]");
|
||||
if (activeTab) {
|
||||
@@ -389,6 +391,10 @@ function initConfigSearch() {
|
||||
});
|
||||
|
||||
if (empty) empty.hidden = totalVisible > 0;
|
||||
if (countBadge) {
|
||||
countBadge.hidden = false;
|
||||
countBadge.textContent = `${totalVisible} 项`;
|
||||
}
|
||||
};
|
||||
|
||||
let debounceTimer;
|
||||
@@ -2130,6 +2136,19 @@ async function pollStats() {
|
||||
setTextIfExists("statFudaiAttendFail", getC("fudai_attend_fail"));
|
||||
setTextIfExists("statFudaiNoWin", getC("fudai_result_no_win"));
|
||||
setTextIfExists("statFudaiWin", getC("fudai_result_win"));
|
||||
// 福袋统计语义着色
|
||||
const colorize = (id, kind, n) => {
|
||||
const el = document.getElementById(id);
|
||||
if (!el) return;
|
||||
el.classList.toggle("stateOk", kind === "ok" && n > 0);
|
||||
el.classList.toggle("stateError", kind === "error" && n > 0);
|
||||
el.classList.toggle("stateWarn", kind === "warn" && n > 0);
|
||||
el.classList.toggle("stateMuted", kind === "muted" && n > 0);
|
||||
};
|
||||
colorize("statFudaiAttendOk", "ok", getC("fudai_attend_ok"));
|
||||
colorize("statFudaiWin", "ok", getC("fudai_result_win"));
|
||||
colorize("statFudaiAttendFail", "error", getC("fudai_attend_fail"));
|
||||
colorize("statFudaiNoWin", "muted", getC("fudai_result_no_win"));
|
||||
setTextIfExists("topFudaiState", UI_COPY.overview.fudaiState(getC("fudai_open_detail"), getC("fudai_attend_ok")));
|
||||
setTextIfExists("topFudaiMeta", UI_COPY.overview.fudaiMeta(getC("fudai_seen"), getC("fudai_result_win")));
|
||||
|
||||
|
||||
+3
-2
@@ -15,7 +15,7 @@
|
||||
} catch (e) {}
|
||||
})();
|
||||
</script>
|
||||
<link rel="stylesheet" href="styles.css?v=console-20260520-theme-v19" />
|
||||
<link rel="stylesheet" href="styles.css?v=console-20260520-theme-v20" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="app">
|
||||
@@ -193,6 +193,7 @@
|
||||
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>
|
||||
</span>
|
||||
<input id="configSearch" type="search" placeholder="搜索配置项 (按标签 / 提示文本)" autocomplete="off" />
|
||||
<span id="configSearchCount" class="workspaceSearchCount" hidden></span>
|
||||
<kbd class="workspaceSearchKbd" aria-hidden="true"><span id="configSearchKbdMod">Ctrl</span> K</kbd>
|
||||
<button id="configSearchClear" type="button" class="workspaceSearchClear" aria-label="清空搜索" hidden>
|
||||
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
||||
@@ -1258,6 +1259,6 @@
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m18 15-6-6-6 6"/></svg>
|
||||
</button>
|
||||
|
||||
<script src="app.js?v=console-20260520-theme-v19"></script>
|
||||
<script src="app.js?v=console-20260520-theme-v20"></script>
|
||||
</body>
|
||||
</html>
|
||||
+45
-8
@@ -1019,6 +1019,25 @@ svg {
|
||||
transition: opacity var(--motion-fast);
|
||||
}
|
||||
|
||||
.workspaceSearchCount {
|
||||
position: absolute;
|
||||
right: 30px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
padding: 1px 7px;
|
||||
border-radius: 99px;
|
||||
background: var(--primary-soft);
|
||||
color: var(--primary-accent-text);
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
font-size: 10px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.workspaceSearchCount[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.workspaceSearch:focus-within .workspaceSearchKbd,
|
||||
.workspaceSearch input:not(:placeholder-shown) ~ .workspaceSearchKbd {
|
||||
opacity: 0;
|
||||
@@ -1224,6 +1243,18 @@ svg {
|
||||
text-transform: uppercase;
|
||||
line-height: 1.3;
|
||||
border-bottom: 1px solid var(--border);
|
||||
position: sticky;
|
||||
top: 64px;
|
||||
z-index: 4;
|
||||
background: linear-gradient(180deg, var(--surface) 70%, color-mix(in oklab, var(--surface) 0%, transparent));
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
|
||||
.cardTitle.sectionTitle,
|
||||
summary.sectionTitle {
|
||||
position: static;
|
||||
background: transparent;
|
||||
backdrop-filter: none;
|
||||
}
|
||||
|
||||
.sectionTitle::before {
|
||||
@@ -1462,11 +1493,12 @@ input[type="number"]::-webkit-outer-spin-button {
|
||||
.chart > .hint:only-child,
|
||||
.reservationsContent > .hint:only-child {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 60px;
|
||||
padding: 16px;
|
||||
min-height: 80px;
|
||||
padding: 24px 16px;
|
||||
border: 1px dashed var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
background: color-mix(in oklab, var(--surface-soft) 60%, transparent);
|
||||
@@ -1479,12 +1511,13 @@ input[type="number"]::-webkit-outer-spin-button {
|
||||
.chart > .hint:only-child::before,
|
||||
.reservationsContent > .hint:only-child::before {
|
||||
content: "";
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 1.5px dashed currentColor;
|
||||
border-radius: 50%;
|
||||
opacity: 0.6;
|
||||
flex: 0 0 14px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
flex: 0 0 28px;
|
||||
background-color: currentColor;
|
||||
-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/></svg>") no-repeat center / contain;
|
||||
mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/></svg>") no-repeat center / contain;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.divider {
|
||||
@@ -1568,6 +1601,10 @@ input[type="number"]::-webkit-outer-spin-button {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.statValue.stateWarn {
|
||||
color: var(--warning);
|
||||
}
|
||||
|
||||
.statValue.hasCopy {
|
||||
position: relative;
|
||||
padding-right: 28px;
|
||||
|
||||
Reference in new issue
Block a user