2026-02-14 15:26:42 +01:00
|
|
|
'use client'
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
BarChart,
|
|
|
|
|
Bar,
|
|
|
|
|
XAxis,
|
|
|
|
|
YAxis,
|
|
|
|
|
CartesianGrid,
|
|
|
|
|
Tooltip,
|
|
|
|
|
ResponsiveContainer,
|
|
|
|
|
Legend,
|
|
|
|
|
} from 'recharts'
|
|
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
|
|
|
|
|
|
|
|
interface StageComparison {
|
Competition/Round architecture: full platform rewrite (Phases 1-9)
Replace Pipeline/Stage system with Competition/Round architecture.
New schema: Competition, Round (7 types), JuryGroup, AssignmentPolicy,
ProjectRoundState, DeliberationSession, ResultLock, SubmissionWindow.
New services: round-engine, round-assignment, deliberation, result-lock,
submission-manager, competition-context, ai-prompt-guard.
Full admin/jury/applicant/mentor UI rewrite. AI prompt hardening with
structured prompts, retry logic, and injection detection. All legacy
pipeline/stage code removed. 4 new migrations + seed aligned.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 23:04:15 +01:00
|
|
|
roundId: string
|
|
|
|
|
roundName: string
|
2026-02-14 15:26:42 +01:00
|
|
|
projectCount: number
|
|
|
|
|
evaluationCount: number
|
|
|
|
|
completionRate: number
|
|
|
|
|
averageScore: number | null
|
|
|
|
|
scoreDistribution: { score: number; count: number }[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface CrossStageComparisonProps {
|
|
|
|
|
data: StageComparison[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const STAGE_COLORS = ['#053d57', '#de0f1e', '#557f8c', '#f38a52', '#6ad82f']
|
|
|
|
|
|
|
|
|
|
export function CrossStageComparisonChart({ data }: CrossStageComparisonProps) {
|
|
|
|
|
// Prepare comparison data
|
|
|
|
|
const comparisonData = data.map((stage, i) => ({
|
Competition/Round architecture: full platform rewrite (Phases 1-9)
Replace Pipeline/Stage system with Competition/Round architecture.
New schema: Competition, Round (7 types), JuryGroup, AssignmentPolicy,
ProjectRoundState, DeliberationSession, ResultLock, SubmissionWindow.
New services: round-engine, round-assignment, deliberation, result-lock,
submission-manager, competition-context, ai-prompt-guard.
Full admin/jury/applicant/mentor UI rewrite. AI prompt hardening with
structured prompts, retry logic, and injection detection. All legacy
pipeline/stage code removed. 4 new migrations + seed aligned.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 23:04:15 +01:00
|
|
|
name: stage.roundName.length > 20 ? stage.roundName.slice(0, 20) + '...' : stage.roundName,
|
2026-02-14 15:26:42 +01:00
|
|
|
projects: stage.projectCount,
|
|
|
|
|
evaluations: stage.evaluationCount,
|
|
|
|
|
completionRate: stage.completionRate,
|
|
|
|
|
avgScore: stage.averageScore ? parseFloat(stage.averageScore.toFixed(2)) : 0,
|
|
|
|
|
color: STAGE_COLORS[i % STAGE_COLORS.length],
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-6">
|
|
|
|
|
{/* Metrics Comparison */}
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<CardTitle>Stage Metrics Comparison</CardTitle>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<div className="h-[350px]">
|
|
|
|
|
<ResponsiveContainer width="100%" height="100%">
|
|
|
|
|
<BarChart
|
|
|
|
|
data={comparisonData}
|
|
|
|
|
margin={{ top: 20, right: 30, bottom: 60, left: 20 }}
|
|
|
|
|
>
|
|
|
|
|
<CartesianGrid strokeDasharray="3 3" className="stroke-muted" />
|
|
|
|
|
<XAxis
|
|
|
|
|
dataKey="name"
|
|
|
|
|
angle={-25}
|
|
|
|
|
textAnchor="end"
|
|
|
|
|
height={60}
|
|
|
|
|
tick={{ fontSize: 12 }}
|
|
|
|
|
/>
|
|
|
|
|
<YAxis />
|
|
|
|
|
<Tooltip
|
|
|
|
|
contentStyle={{
|
|
|
|
|
backgroundColor: 'hsl(var(--card))',
|
|
|
|
|
border: '1px solid hsl(var(--border))',
|
|
|
|
|
borderRadius: '6px',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Legend />
|
|
|
|
|
<Bar dataKey="projects" name="Projects" fill="#053d57" radius={[4, 4, 0, 0]} />
|
|
|
|
|
<Bar dataKey="evaluations" name="Evaluations" fill="#557f8c" radius={[4, 4, 0, 0]} />
|
|
|
|
|
</BarChart>
|
|
|
|
|
</ResponsiveContainer>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
{/* Completion & Score Comparison */}
|
|
|
|
|
<div className="grid gap-6 lg:grid-cols-2">
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<CardTitle>Completion Rate by Stage</CardTitle>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<div className="h-[300px]">
|
|
|
|
|
<ResponsiveContainer width="100%" height="100%">
|
|
|
|
|
<BarChart
|
|
|
|
|
data={comparisonData}
|
|
|
|
|
margin={{ top: 20, right: 20, bottom: 60, left: 20 }}
|
|
|
|
|
>
|
|
|
|
|
<CartesianGrid strokeDasharray="3 3" className="stroke-muted" />
|
|
|
|
|
<XAxis
|
|
|
|
|
dataKey="name"
|
|
|
|
|
angle={-25}
|
|
|
|
|
textAnchor="end"
|
|
|
|
|
height={60}
|
|
|
|
|
tick={{ fontSize: 12 }}
|
|
|
|
|
/>
|
|
|
|
|
<YAxis domain={[0, 100]} unit="%" />
|
|
|
|
|
<Tooltip
|
|
|
|
|
contentStyle={{
|
|
|
|
|
backgroundColor: 'hsl(var(--card))',
|
|
|
|
|
border: '1px solid hsl(var(--border))',
|
|
|
|
|
borderRadius: '6px',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Bar dataKey="completionRate" name="Completion %" fill="#6ad82f" radius={[4, 4, 0, 0]} />
|
|
|
|
|
</BarChart>
|
|
|
|
|
</ResponsiveContainer>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<CardTitle>Average Score by Stage</CardTitle>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<div className="h-[300px]">
|
|
|
|
|
<ResponsiveContainer width="100%" height="100%">
|
|
|
|
|
<BarChart
|
|
|
|
|
data={comparisonData}
|
|
|
|
|
margin={{ top: 20, right: 20, bottom: 60, left: 20 }}
|
|
|
|
|
>
|
|
|
|
|
<CartesianGrid strokeDasharray="3 3" className="stroke-muted" />
|
|
|
|
|
<XAxis
|
|
|
|
|
dataKey="name"
|
|
|
|
|
angle={-25}
|
|
|
|
|
textAnchor="end"
|
|
|
|
|
height={60}
|
|
|
|
|
tick={{ fontSize: 12 }}
|
|
|
|
|
/>
|
|
|
|
|
<YAxis domain={[0, 10]} />
|
|
|
|
|
<Tooltip
|
|
|
|
|
contentStyle={{
|
|
|
|
|
backgroundColor: 'hsl(var(--card))',
|
|
|
|
|
border: '1px solid hsl(var(--border))',
|
|
|
|
|
borderRadius: '6px',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Bar dataKey="avgScore" name="Avg Score" fill="#de0f1e" radius={[4, 4, 0, 0]} />
|
|
|
|
|
</BarChart>
|
|
|
|
|
</ResponsiveContainer>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|