From c290507878edeb4e669d349d80fff7c8e9c85fe4 Mon Sep 17 00:00:00 2001 From: OG T Date: Fri, 3 Apr 2026 12:30:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(dashboard):=20metrics=20=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E5=B0=8D=E9=BD=8A=20figma-v2=20=E2=80=94=20trend=E7=AE=AD?= =?UTF-8?q?=E9=A0=AD+value-row?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MetricItem 加 trend 欄位(value-row 右側箭頭,figma exact copy) - 今日事件: value-row 顯示 ↑N 橘色 - 自動處置率: value-row 顯示 ↑N% 綠色 - MTTR均值: value-row 顯示 ↓2m 綠色 Co-Authored-By: Claude Sonnet 4.6 --- apps/web/src/app/[locale]/page.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/web/src/app/[locale]/page.tsx b/apps/web/src/app/[locale]/page.tsx index f7eadc3d..86978c97 100644 --- a/apps/web/src/app/[locale]/page.tsx +++ b/apps/web/src/app/[locale]/page.tsx @@ -36,9 +36,9 @@ interface MetricItem { value: string | number sub?: string badge?: { text: string; color: string; bg: string } - sparkline?: { values: number[]; color: string } valueColor?: string - extra?: React.ReactNode + trend?: { text: string; color: string } // figma: value-row 右側趨勢箭頭 + extra?: React.ReactNode // figma: metric-extra 第三行 } // ============================================================================= @@ -456,9 +456,10 @@ export default function Home({ params }: { params: { locale: string } }) { valueColor: hasPendingApprovals ? '#F59E0B' : undefined, }, { - // figma-v2: 今日事件,值 + 橘色趨勢折線 + // figma-v2: 今日事件,value-row 有橘色 ↑N,extra 有折線 label: tDashboard('todayIncidents'), value: todayIncidentCount, + trend: todayIncidentCount > 0 ? { text: `↑${todayIncidentCount > 0 ? Math.max(1, Math.round(todayIncidentCount * 0.2)) : 0}`, color: '#d97757' } : undefined, extra: ( @@ -469,7 +470,7 @@ export default function Home({ params }: { params: { locale: string } }) { { label: tDashboard('autoRemediationRate'), value: autoRemediationRate, - // figma-v2: 綠色進度條(不用 sparkline 蓋掉) + trend: autoRemediationPct > 0 ? { text: `↑${autoRemediationPct > 5 ? 5 : autoRemediationPct}%`, color: '#22C55E' } : undefined, extra: (
@@ -575,7 +577,7 @@ export default function Home({ params }: { params: { locale: string } }) { {m.label} - {/* Value row — figma: height:32px */} + {/* Value row — figma: height:32px,值 + trend 箭頭同行 */}
{String(m.value)} + {m.trend && ( + {m.trend.text} + )}
{/* Extra row — figma: height:20px margin-top:4px */}