import React from 'react'; import { PieChart, Pie, Cell, ResponsiveContainer, Legend, Tooltip } from 'recharts'; import type { StanceStats } from '../../utils/analysis.utils.ts'; type StanceDistributionChartProps = { stats: StanceStats; }; const COLORS = { PRO: '#10b981', // green-500 CON: '#ef4444', // red-500 }; const StanceDistributionChart = ({ stats }: StanceDistributionChartProps) => { const data = [ { name: 'PRO', value: stats.pro, percentage: stats.proPercentage }, { name: 'CON', value: stats.con, percentage: stats.conPercentage }, ]; return (
`${name}: ${percentage.toFixed(1)}%`} outerRadius={80} fill="#8884d8" dataKey="value" > {data.map((entry, index) => ( ))} [ `${value} (${props.payload.percentage.toFixed(1)}%)`, name, ]} />
); }; export default StanceDistributionChart;