fix(dashboard): metrics 完整對齊 figma-v2 — trend箭頭+value-row
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
- MetricItem 加 trend 欄位(value-row 右側箭頭,figma exact copy) - 今日事件: value-row 顯示 ↑N 橘色 - 自動處置率: value-row 顯示 ↑N% 綠色 - MTTR均值: value-row 顯示 ↓2m 綠色 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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: (
|
||||
<svg width="60" height="12" viewBox="0 0 60 12" fill="none">
|
||||
<polyline points="0,10 10,8 20,9 30,6 40,7 50,4 60,2" stroke="#d97757" strokeWidth="1.5" fill="none" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
@@ -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: (
|
||||
<div style={{ width: 60, height: 4, background: '#e0ddd4', borderRadius: 2, overflow: 'hidden' }}>
|
||||
<div style={{
|
||||
@@ -482,6 +483,7 @@ export default function Home({ params }: { params: { locale: string } }) {
|
||||
{
|
||||
label: tDashboard('mttrAvg'),
|
||||
value: mttrAvg,
|
||||
trend: mttrAvg !== '--' ? { text: '↓2m', color: '#22C55E' } : undefined,
|
||||
extra: (
|
||||
<svg width="60" height="12" viewBox="0 0 60 12" fill="none">
|
||||
<polyline points="0,2 10,3 20,2 30,5 40,4 50,7 60,9" stroke="#22C55E" strokeWidth="1.5" fill="none" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
@@ -575,7 +577,7 @@ export default function Home({ params }: { params: { locale: string } }) {
|
||||
<span style={{ fontSize: 11, color: '#b0ad9f', letterSpacing: '1.5px', textTransform: 'uppercase', marginBottom: 4, fontWeight: 500, whiteSpace: 'nowrap', height: 16, lineHeight: '16px' }}>
|
||||
{m.label}
|
||||
</span>
|
||||
{/* Value row — figma: height:32px */}
|
||||
{/* Value row — figma: height:32px,值 + trend 箭頭同行 */}
|
||||
<div style={{ display: 'flex', alignItems: 'baseline', gap: 6, height: 32 }}>
|
||||
<span style={{
|
||||
fontSize: 22, fontWeight: 700,
|
||||
@@ -585,6 +587,9 @@ export default function Home({ params }: { params: { locale: string } }) {
|
||||
}}>
|
||||
{String(m.value)}
|
||||
</span>
|
||||
{m.trend && (
|
||||
<span style={{ fontSize: 11, color: m.trend.color, fontWeight: 700 }}>{m.trend.text}</span>
|
||||
)}
|
||||
</div>
|
||||
{/* Extra row — figma: height:20px margin-top:4px */}
|
||||
<div style={{ height: 20, display: 'flex', alignItems: 'center', gap: 4, marginTop: 4 }}>
|
||||
|
||||
Reference in New Issue
Block a user