import { Badge } from '@/components/ui/Badge' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/Table' import { HISTORICAL_SERIES_YEARS } from '@/lib/electionResults' import type { CandidateComparisonRow } from '@/utilities/municipalityCandidateComparison' const voteFormatter = new Intl.NumberFormat('pt-BR') /** Candidates × years vote table for one municipality — the coordination's analysis tool. */ export const MunicipalityCandidateComparisonTable = ({ rows }: { rows: CandidateComparisonRow[] }) => (
Candidato {HISTORICAL_SERIES_YEARS.map((year) => ( {year} ))} {rows.map((row) => (
{row.name} {row.party ? ({row.party}) : null} {row.isReference ? Nossa campanha : null}
{HISTORICAL_SERIES_YEARS.map((year) => ( {voteFormatter.format(row.votesByYear[String(year)] ?? 0)} ))}
))}
)