"use client"; /* * Corpus subject-distribution donut. * * Pure CSS conic-gradient — same recipe as the cases StatusDonut, but * uses a palette-of-gold instead of a status-tone palette. Ported from * legal-ai/web/static/index.html `renderHero`. */ const DONUT_COLORS = [ "var(--color-navy)", "var(--color-gold)", "var(--color-info)", "var(--color-warn)", "var(--color-success)", "var(--color-ink-muted)", "var(--color-gold-deep)", ]; export function SubjectDonut({ segments, total, }: { segments: Array<{ label: string; count: number }>; total: number; }) { let pct = 0; const parts = segments.map((s, i) => { const start = total === 0 ? 0 : (pct / total) * 360; pct += s.count; const end = total === 0 ? 360 : (pct / total) * 360; return { ...s, start, end, color: DONUT_COLORS[i % DONUT_COLORS.length] }; }); const background = total === 0 ? "conic-gradient(var(--color-rule-soft) 0deg 360deg)" : `conic-gradient(${parts .map((p) => `${p.color} ${p.start}deg ${p.end}deg`) .join(", ")})`; return (