mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-20 18:24:45 +00:00
436 seeded Praças (municipality-based; per-TSE-zone in Salvador/Camaçari) become the operational unit; roles renamed to coordinator/advisor/leader with advisors scoped to administered Praças. Leadership is one record per person across many Praças/organizations; vote pledges split leader-declared vs staff-estimated (estimates never serialized to leaders). Adds organizations, demand workflow with staff-only cost/receipts, action-plan results with deputy presence, manual political trend, multi-candidate comparison and the diverging red/white/blue map mode. Migration 20260721_020109_remodel_plazas deliberately resets the campaign vertical in production (public site untouched); test suite ported to the new model (unit 187 / int 306 / e2e 9 green).
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
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/plazaCandidateComparison'
|
||
|
||
const voteFormatter = new Intl.NumberFormat('pt-BR')
|
||
|
||
/** Candidates × years vote table for one plaza — the coordination's analysis tool. */
|
||
export const PlazaCandidateComparisonTable = ({ rows }: { rows: CandidateComparisonRow[] }) => (
|
||
<div className="overflow-hidden rounded-xl border">
|
||
<Table>
|
||
<TableHeader>
|
||
<TableRow>
|
||
<TableHead>Candidato</TableHead>
|
||
{HISTORICAL_SERIES_YEARS.map((year) => (
|
||
<TableHead key={year} className="text-right">
|
||
{year}
|
||
</TableHead>
|
||
))}
|
||
</TableRow>
|
||
</TableHeader>
|
||
<TableBody>
|
||
{rows.map((row) => (
|
||
<TableRow key={row.candidateNumber} data-reference={row.isReference || undefined}>
|
||
<TableCell className="whitespace-normal">
|
||
<div className="flex flex-wrap items-center gap-2">
|
||
<span className={row.isReference ? 'font-semibold' : 'font-medium'}>
|
||
{row.name}
|
||
</span>
|
||
{row.party ? <span className="text-muted-foreground">({row.party})</span> : null}
|
||
{row.isReference ? <Badge variant="scope">Nossa campanha</Badge> : null}
|
||
</div>
|
||
</TableCell>
|
||
{HISTORICAL_SERIES_YEARS.map((year) => (
|
||
<TableCell key={year} className="text-right tabular-nums">
|
||
{voteFormatter.format(row.votesByYear[String(year)] ?? 0)}
|
||
</TableCell>
|
||
))}
|
||
</TableRow>
|
||
))}
|
||
</TableBody>
|
||
</Table>
|
||
</div>
|
||
)
|