import React from 'react'; export interface MetricCard { label: string; value: number | string; /** previous period value for trend calculation */ previousValue?: number; currentValue?: number; /** When true, a decrease is good (green) and an increase is bad (red). Use for error counts, latency, etc. */ lowerIsBetter?: boolean; } function TrendBadge({ current, previous, lowerIsBetter = false }: { current: number; previous: number; lowerIsBetter?: boolean }): React.ReactElement { if (previous === 0 && current === 0) { return —; } const upColor = lowerIsBetter ? 'text-red-600' : 'text-green-600'; const downColor = lowerIsBetter ? 'text-green-600' : 'text-red-600'; if (current > previous) { const pct = previous > 0 ? Math.round(((current - previous) / previous) * 100) : 100; return ( ↑ {pct}% ); } if (current < previous) { const pct = previous > 0 ? Math.round(((previous - current) / previous) * 100) : 100; return ( ↓ {pct}% ); } return —; } function SkeletonCard(): React.ReactElement { return (
{card.label}
{card.value}
{card.currentValue !== undefined && card.previousValue !== undefined && (