import styles from './StatsRing.module.css'; interface Props { exact: number; tendency: number; wrong: number; total: number; } export default function StatsRing({ exact, tendency, wrong, total }: Props) { const radius = 55; const circumference = 2 * Math.PI * radius; const all = exact + tendency + wrong || 1; const segments = [ { value: exact / all, color: 'var(--gold)', label: 'Exakt' }, { value: tendency / all, color: 'var(--success)', label: 'Tendenz' }, { value: wrong / all, color: 'var(--error)', label: 'Falsch' }, ]; let offset = 0; return (
{/* Background circle */} {segments.map((seg, i) => { if (seg.value === 0) return null; const dashArray = `${seg.value * circumference} ${circumference}`; const rotation = offset * 360 - 90; offset += seg.value; return ( ); })} {total} Punkte
{segments.map((seg, i) => ( {seg.label}: {Math.round(seg.value * all)} ))}
); }