'use client'; import { PieChart, Pie, Cell, ResponsiveContainer, Tooltip, Legend } from 'recharts'; interface StatusDistributionData { status: string; count: number; percentage: number; color: string; } interface StatusDistributionChartProps { data: StatusDistributionData[]; className?: string; } export function StatusDistributionChart({ data, className }: StatusDistributionChartProps) { // Transformer les statuts pour l'affichage const getStatusLabel = (status: string) => { const labels: { [key: string]: string } = { 'pending': 'En attente', 'in_progress': 'En cours', 'blocked': 'Bloquées', 'done': 'Terminées', 'archived': 'Archivées' }; return labels[status] || status; }; const chartData = data.map(item => ({ ...item, name: getStatusLabel(item.status), value: item.count })); // eslint-disable-next-line @typescript-eslint/no-explicit-any const CustomTooltip = ({ active, payload }: { active?: boolean; payload?: any[] }) => { if (active && payload && payload.length) { const data = payload[0].payload; return (
{data.name}
{data.count} tâches ({data.percentage}%)