diff --git a/apps/web/messages/en.json b/apps/web/messages/en.json index a1e2b4a5..384e2f39 100644 --- a/apps/web/messages/en.json +++ b/apps/web/messages/en.json @@ -310,7 +310,11 @@ "suggestedAction": "> Suggested action:", "authorize": "Authorize", "reject": "Reject", - "anomaly": "anomaly" + "anomaly": "anomaly", + "affectedServices": "Affected Services", + "signalCount": "Signals", + "statusLabel": "Status", + "aiProposal": "AI Proposal" } }, "status": { diff --git a/apps/web/messages/zh-TW.json b/apps/web/messages/zh-TW.json index c89f8bbf..5742acbd 100644 --- a/apps/web/messages/zh-TW.json +++ b/apps/web/messages/zh-TW.json @@ -311,7 +311,11 @@ "suggestedAction": "> 建議行動:", "authorize": "授權", "reject": "拒絕", - "anomaly": "異常" + "anomaly": "異常", + "affectedServices": "影響服務", + "signalCount": "信號數", + "statusLabel": "狀態", + "aiProposal": "AI 提案" } }, "status": { diff --git a/apps/web/src/app/[locale]/page.tsx b/apps/web/src/app/[locale]/page.tsx index 0f2fb259..dcaea2d1 100644 --- a/apps/web/src/app/[locale]/page.tsx +++ b/apps/web/src/app/[locale]/page.tsx @@ -20,6 +20,19 @@ import { OpenClawPanel } from '@/components/ai/openclaw-panel' import { HostGrid, type HostInfo } from '@/components/infra/host-grid' import { AppLayout } from '@/components/layout' +// ============================================================================= +// Types +// ============================================================================= + +interface MetricItem { + label: string + value: string | number + sub?: string + badge?: { text: string; color: string; bg: string } + sparkline?: { values: number[]; color: string } + valueColor?: string +} + // ============================================================================= // Mini Sparkline (SVG inline) // ============================================================================= @@ -118,14 +131,7 @@ export default function Home({ params }: { params: { locale: string } }) { // ── 7 Metrics Strip ───────────────────────────────────────────────────────── - type MetricItem = { - label: string - value: string | number - sub?: string - badge?: { text: string; color: string; bg: string } - sparkline?: { values: number[]; color: string } - valueColor?: string - } + const hasPendingApprovals = pendingApprovals !== null && pendingApprovals !== undefined && pendingApprovals > 0 const metrics: MetricItem[] = [ { @@ -144,9 +150,9 @@ export default function Home({ params }: { params: { locale: string } }) { { label: tDashboard('pendingApprovals'), value: pendingApprovals ?? '--', - sub: pendingApprovals > 0 ? undefined : tDashboard('stable'), - badge: pendingApprovals > 0 ? { text: tDashboard('pendingApprovals'), color: '#F59E0B', bg: 'rgba(245,158,11,0.08)' } : undefined, - valueColor: pendingApprovals > 0 ? '#F59E0B' : undefined, + sub: hasPendingApprovals ? undefined : tDashboard('stable'), + badge: hasPendingApprovals ? { text: `⏳ ${pendingApprovals}`, color: '#F59E0B', bg: 'rgba(245,158,11,0.08)' } : undefined, + valueColor: hasPendingApprovals ? '#F59E0B' : undefined, }, { label: tDashboard('autoRemediationRate'), @@ -184,8 +190,7 @@ export default function Home({ params }: { params: { locale: string } }) {