import { cn } from "@/lib/utils"; /** * Commit-Aktivitaet als kleine Balkenreihe. * * Bewusst als reines SVG ohne Diagrammbibliothek: es sind dreissig Werte, * die Achsen, Legende und Tooltips einer Bibliothek waeren hier nur Ballast. */ export function Sparkline({ values, className, height = 28, label = "Commits", }: { values: number[]; className?: string; height?: number; label?: string; }) { if (!values.length) return null; const total = values.reduce((sum, value) => sum + value, 0); if (total === 0) return null; const max = Math.max(...values); const gap = 1; const barWidth = 3; const width = values.length * (barWidth + gap) - gap; return ( {`${label} der letzten ${values.length} Tage: insgesamt ${total}`} {values.map((value, index) => { // Auch ein einzelner Commit soll sichtbar sein, daher die Untergrenze. const barHeight = value === 0 ? 1.5 : Math.max(3, (value / max) * height); return ( ); })} ); }