import React from 'react'; import { cn } from '@/lib/utils'; const STAGES = [ { key: 'applied', label: 'Applied', color: 'bg-[#D1E0D7]', text: 'text-[#333F48]' }, { key: 'ai_screened', label: 'AI Screened', color: 'bg-[#F8E08E]', text: 'text-[#333F48]' }, { key: 'shortlisted', label: 'Shortlisted', color: 'bg-[#F9E547]', text: 'text-[#0838E0]' }, { key: 'interview', label: 'Interviewed', color: 'bg-[#333F48]', text: 'text-white' }, { key: 'hired', label: 'Hired', color: 'bg-[#0838E0]', text: 'text-white' }, ]; export default function PipelineFunnel({ applications }) { const counts = STAGES.map((s) => { if (s.key === 'ai_screened') { return applications.filter(a => ['ai_screened', 'shortlisted', 'interview', 'hired'].includes(a.status)).length; } if (s.key === 'shortlisted') { return applications.filter(a => ['shortlisted', 'interview', 'hired'].includes(a.status)).length; } if (s.key === 'interview') { return applications.filter(a => ['interview', 'hired'].includes(a.status)).length; } return applications.filter(a => a.status === s.key).length; }); const max = Math.max(...counts, 1); const total = counts[0] || 1; return (

Pipeline Stages

Candidate progression through hiring funnel

{STAGES.map((stage, i) => { const count = counts[i]; const width = (count / max) * 100; const convRate = i === 0 ? 100 : Math.round((count / total) * 100); const stepRate = i === 0 ? 100 : (counts[i - 1] ? Math.round((count / counts[i - 1]) * 100) : 0); return (
{stage.label} {i > 0 && stepRate <= 100 && ( → {stepRate}% from prev )}
{convRate}% of total {count}
0 ? 6 : 0)}%` }} > {count > 0 ? count : ''}
); })}
); }