import React, { useMemo } from 'react'; import { ResponsiveContainer, BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Cell } from 'recharts'; const TIERS = [ { label: '0-39', range: [0, 39], color: '#333F48' }, { label: '40-59', range: [40, 59], color: '#D1E0D7' }, { label: '60-79', range: [60, 79], color: '#F8E08E' }, { label: '80-100', range: [80, 100], color: '#0838E0' }, ]; export default function ScoreDistribution({ applications }) { const data = useMemo(() => { const scored = applications.filter(a => a.ai_score > 0); return TIERS.map((tier) => ({ label: tier.label, count: scored.filter(a => a.ai_score >= tier.range[0] && a.ai_score <= tier.range[1]).length, color: tier.color, })); }, [applications]); const avgScore = useMemo(() => { const scored = applications.filter(a => a.ai_score > 0); return scored.length ? Math.round(scored.reduce((s, a) => s + a.ai_score, 0) / scored.length) : 0; }, [applications]); const screened = applications.filter(a => a.ai_score > 0).length; return (

Candidate Scores

{avgScore}
AVG SCORE

{screened} candidates screened

{data.map((entry, i) => ( ))}
{TIERS.map((t, i) => (
{t.label}
{data[i].count}
))}
); }