Some checks failed
Build and Push Docker Image / build (push) Failing after 23s
- Migrate 9 chart components from Nivo to @tremor/react (BarChart, AreaChart, DonutChart, ScatterChart) - Remove @nivo/*, @react-spring/web dependencies (45 packages removed) - Redesign dashboard: 6 stat tiles, competition pipeline, score distribution, juror workload, activity feed - Add new /observer/projects page with search, filters, sorting, pagination, CSV export - Restructure reports page from 5 tabs to 3 (Progress, Jurors, Scores & Analytics) with per-tab CSV export - Redesign project detail: breadcrumb nav, score card header, 3-tab layout (Overview/Evaluations/Files) - Update loading skeletons to match new layouts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import { DonutChart } from '@tremor/react'
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
import { getStatusColor, formatStatus } from './chart-theme'
|
|
|
|
interface StatusDataPoint {
|
|
status: string
|
|
count: number
|
|
}
|
|
|
|
interface StatusBreakdownProps {
|
|
data: StatusDataPoint[]
|
|
}
|
|
|
|
export function StatusBreakdownChart({ data }: StatusBreakdownProps) {
|
|
if (!data?.length) return null
|
|
|
|
const total = data.reduce((sum, item) => sum + item.count, 0)
|
|
|
|
const chartData = data.map((d) => ({
|
|
name: formatStatus(d.status),
|
|
value: d.count,
|
|
}))
|
|
|
|
const colors = data.map((d) => getStatusColor(d.status))
|
|
|
|
return (
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle className="flex items-center justify-between">
|
|
<span>Project Status Distribution</span>
|
|
<span className="text-sm font-normal text-muted-foreground">
|
|
{total} projects
|
|
</span>
|
|
</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<DonutChart
|
|
data={chartData}
|
|
category="value"
|
|
index="name"
|
|
colors={colors as string[]}
|
|
showLabel={true}
|
|
className="h-[300px]"
|
|
/>
|
|
</CardContent>
|
|
</Card>
|
|
)
|
|
}
|