Show forecast completion state in dashboard panels

This commit is contained in:
2569718930@qq.com
2026-04-18 01:04:36 +08:00
parent 37f4705f9c
commit 16033033a7
3 changed files with 86 additions and 16 deletions
+13 -3
View File
@@ -190,6 +190,12 @@ export function DetailPanel() {
const heroSettlementLabel =
detail?.current?.settlement_source_label || basicSettlementLabel;
const heroAirportLabel = detail?.risk?.airport || basicAirportLabel;
const isDetailCompleting = Boolean(
detail &&
(detail.detail_depth !== "full" ||
(detail.forecast?.daily?.length ?? 0) <= 1),
);
const isPanelSyncing = store.loadingState.cityDetail || isDetailCompleting;
const blurActiveElement = () => {
if (typeof document === "undefined") return;
@@ -309,13 +315,17 @@ export function DetailPanel() {
</div>
<h2>{panelDisplayName}</h2>
</div>
{store.loadingState.cityDetail && (
{isPanelSyncing && (
<div className="panel-loading-hint" role="status" aria-live="polite">
<span className="panel-loading-spinner" aria-hidden="true" />
<span>
{locale === "en-US"
? `Syncing ${panelDisplayName}...`
: `正在同步 ${panelDisplayName}...`}
? isDetailCompleting
? `Completing ${panelDisplayName} cards...`
: `Syncing ${panelDisplayName}...`
: isDetailCompleting
? `正在补齐 ${panelDisplayName} 卡片...`
: `正在同步 ${panelDisplayName}...`}
</span>
</div>
)}