'use client' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import { Progress } from '@/components/ui/progress' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table' import { scoreGradient } from './chart-theme' import { ArrowRight } from 'lucide-react' interface StageComparison { roundId: string roundName: string projectCount: number evaluationCount: number completionRate: number averageScore: number | null scoreDistribution: { score: number; count: number }[] } interface CrossStageComparisonProps { data: StageComparison[] } export function CrossStageComparisonChart({ data, }: CrossStageComparisonProps) { if (!data?.length) { return (

No comparison data available

) } const maxProjects = Math.max(...data.map((d) => d.projectCount), 1) return ( Round Progression {/* Pipeline funnel visualization */}
{data.map((round, idx) => (
{round.projectCount}

{round.roundName}

{idx < data.length - 1 && (
{data[idx + 1].projectCount < round.projectCount && ( -{round.projectCount - data[idx + 1].projectCount} )}
)}
))}
{/* Detailed metrics table */}
Round Projects Evaluations Completion Avg Score {data.map((round, idx) => { const prevCount = idx > 0 ? data[idx - 1].projectCount : null const attrition = prevCount !== null && prevCount > 0 ? Math.round(((prevCount - round.projectCount) / prevCount) * 100) : null return (
{round.roundName} {attrition !== null && attrition > 0 && ( -{attrition}% )}
{round.projectCount} {round.evaluationCount > 0 ? round.evaluationCount : '—'} {round.evaluationCount > 0 ? (
{round.completionRate}%
) : ( )}
{round.averageScore !== null ? ( {round.averageScore.toFixed(1)} ) : ( )}
) })}
) }