feat(web): clean public home header (data date, 7d fans, video count), drop status panel

This commit is contained in:
kairee committed 2026-11-01 17:38:30 +08:00
1 parent a392453851
commit 85b0f625a9
5 files changed
+9 -34

No files matched your search

-1
View File
@@ -476,7 +476,6 @@ a.live-chip:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--bo
.status-grid strong { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 650; }
/* 预计下次运行等 3 项:PC 与移动端都保持一行 */
.status-grid.status-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.status-panel .text-link { display: inline-block; margin-top: 10px; }
.segmented {
display: inline-flex;
+6 -30
View File
@@ -1,9 +1,7 @@
import { api } from "../api.js";
import { emptyState, mediaCard } from "../components.js";
import {
emptyState, mediaCard, sectionHeader,
} from "../components.js";
import {
escapeAttr, escapeHtml, formatCount, formatDate, formatDelta, formatDateTime,
escapeAttr, escapeHtml, formatCount, formatDate, formatDelta,
formatDuration, formatPercent, formatScore,
} from "../format.js";
@@ -51,20 +49,18 @@ export async function renderHome(root) {
api("/api/videos", { sort: "growth", growth_days: 7, limit: 6 }),
]);
const pending = overview.counts.candidates_pending || 0;
const fans = overview.fans;
const firstDay = overview.is_first_day;
const addedLabel = firstDay
? formatCount(overview.initial_import_count)
: formatCount(overview.added_today);
const health = overview.snapshot_health || { total: 0, ok: 0, failed: 0 };
const activeCount = overview.counts?.active || 0;
root.innerHTML = `<section class="page home-page">
<header class="page-head home-head">
<div>
<h1>最新动态</h1>
<p class="page-sub">数据 ${escapeHtml(overview.data_date || "—")} ·
采集 ${health.ok}/${health.total}${health.failed ? ` · 失败 ${health.failed}` : ""}</p>
<p class="page-sub">收录视频 ${formatCount(activeCount)}</p>
</div>
<button class="icon-button" id="refresh-home" type="button" title="刷新">刷新</button>
</header>
@@ -76,19 +72,12 @@ export async function renderHome(root) {
${statChip("播放增量", overview.view_delta_available ? formatDelta(overview.view_delta) : "—", {
href: "/videos?sort=growth&growth_days=1",
})}
${statChip("粉丝日增", fans?.delta_1d === null || fans?.delta_1d === undefined ? "—" : formatDelta(fans.delta_1d), {
${statChip("7 日粉丝变化", fans?.delta_7d === null || fans?.delta_7d === undefined ? "—" : formatDelta(fans.delta_7d), {
href: "/fans",
})}
${statChip("待确认候选", formatCount(pending), {
href: "/candidates", tone: pending ? "warning" : "",
})}
${statChip("数据日期", escapeHtml(overview.data_date || "—"))}
</div>
${pending ? `<a class="notice-row" href="/candidates">
<strong>${formatCount(pending)} 条候选待确认</strong>
<span>请在 Telegram 中处理 →</span>
</a>` : ""}
<section class="panel">
<div class="section-head">
<h2>最近发布</h2>
@@ -118,19 +107,6 @@ export async function renderHome(root) {
</div>
${heatGrid(heat.items)}
</section>
<section class="panel status-panel">
${sectionHeader("采集状态")}
<div class="status-grid">
<div><span>快照完成</span><strong>${overview.snapshot_completed_today ? "是" : "否"}</strong></div>
<div><span>数据日期</span><strong>${escapeHtml(overview.data_date || "—")}</strong></div>
<div><span>粉丝</span><strong>${formatCount(fans?.follower)}</strong></div>
<div><span>7 日粉丝</span><strong>${fans?.delta_7d === null || fans?.delta_7d === undefined ? "—" : formatDelta(fans.delta_7d)}</strong></div>
<div><span>最近快照</span><strong>${escapeHtml(formatDateTime(overview.tasks?.snapshot?.finished_at))}</strong></div>
<div><span>最近发现</span><strong>${escapeHtml(formatDateTime(overview.tasks?.discovery?.finished_at))}</strong></div>
</div>
<a class="text-link" href="/system">查看系统状态 →</a>
</section>
</section>`;
root.querySelector("#refresh-home")?.addEventListener("click", () => window.location.reload());