interface Props { label: string; value: string; history?: number[]; unit?: string; color?: string; // tailwind color class for the sparkline stroke max?: number; } const SPARKLINE_H = 32; const SPARKLINE_W = 120; function Sparkline({ data, color = '#a78bfa', max }: { data: number[]; color?: string; max?: number }) { const points = data.length >= 2 ? (() => { const dataMax = max ?? Math.max(...data, 1); const dataMin = Math.min(...data, 0); const range = dataMax - dataMin || 1; return data.map((v, i) => { const x = (i / (data.length - 1)) * SPARKLINE_W; const y = SPARKLINE_H - ((v - dataMin) / range) * SPARKLINE_H; return `${x},${y}`; }).join(' '); })() : null; return ( ); } export function GaugeCard({ label, value, history, color = '#a78bfa', max }: Props) { return (