// ======================================== // WorkflowStatusPieChart Component // ======================================== // Recharts pie chart visualizing workflow status distribution import { useMemo } from 'react'; import { PieChart, Pie, Cell, Tooltip, Legend, ResponsiveContainer } from 'recharts'; import type { WorkflowStatusCount } from '@/hooks/useWorkflowStatusCounts'; import { getChartColors, STATUS_COLORS } from '@/lib/chartTheme'; export interface WorkflowStatusPieChartProps { /** Workflow status count data */ data: WorkflowStatusCount[]; /** Optional CSS class name */ className?: string; /** Chart height (default: 300) */ height?: number; /** Optional label for the chart */ title?: string; } /** * Custom tooltip component for the pie chart */ function CustomTooltip({ active, payload }: any) { if (active && payload && payload.length) { const { name, value, payload: data } = payload[0]; const percentage = data.percentage ?? Math.round((value / 100) * 100); return (
{name}
{value} ({percentage}%)