import React from 'react'; import { cn } from '@/lib/utils'; const TIERS = [ { label: 'Top Talent', range: '80-100', color: 'bg-[#1E3A8A]', textColor: 'text-[#1E3A8A]' }, { label: 'Strong Fit', range: '60-79', color: 'bg-[#60A5FA]', textColor: 'text-[#2563EB]' }, { label: 'Possible Fit', range: '40-59', color: 'bg-[#93C5FD]', textColor: 'text-[#3B82F6]' }, { label: 'Not a Fit', range: '0-39', color: 'bg-[#E5E7EB]', textColor: 'text-[#9CA3AF]' }, ]; function getTier(score) { if (score >= 80) return 0; if (score >= 60) return 1; if (score >= 40) return 2; return 3; } export default function KROWCandidateLeaderboard({ applications, maxBars = 4 }) { const screened = applications.filter(a => a.ai_score > 0 || a.status !== 'applied'); const counts = TIERS.map((_, i) => screened.filter(a => getTier(a.ai_score || 0) === i).length); const total = counts.reduce((a, b) => a + b, 0) || 1; const sorted = [...screened].sort((a, b) => (b.ai_score || 0) - (a.ai_score || 0)); return (

Candidate Pipeline

{/* Bar chart */}
{TIERS.map((tier, i) => { const count = counts[i]; const pct = (count / total) * 100; return (
{tier.label} ({tier.range}) {count}
0 ? 4 : 0)}%` }} />
); })}
{/* Ranked list */}
{sorted.slice(0, 5).map((app, idx) => (
#{idx + 1}
{app.applicant_name?.split(' ').map(w => w[0]).slice(0, 2).join('').toUpperCase()}
{app.applicant_name}
{app.job_title || 'Applicant'}
{app.ai_score || 0}
))} {sorted.length === 0 && (
No screened candidates yet
)}
); }