import { TOPIC_LABELS } from '../utils/topicLabels.js' const TOPIC_COLORS = { algebra: '#10B981', geometry: '#FBBF24', statistics: '#FB7185', combinatorics:'#10B981', } function barColor(accuracy) { if (accuracy >= 0.7) return '#10B981' if (accuracy >= 0.5) return '#FBBF24' return '#FB7185' } /** * Vertical bar chart showing per-topic accuracy. * Bars are colored green/amber/red based on accuracy thresholds. * * @example * */ export default function TopicBreakdownChart({ topicBreakdown }) { const entries = Object.entries(topicBreakdown) const maxAcc = Math.max(...entries.map(([, tb]) => tb.accuracy), 0.01) return (
{entries.map(([topic, tb]) => { const color = TOPIC_COLORS[topic] ?? barColor(tb.accuracy) const heightPct = (tb.accuracy / maxAcc) * 100 return (
{TOPIC_LABELS[topic] ?? topic}
) })}
) }