import { PledgeEstimateForm } from '@/components/campaign/PledgeEstimateForm' import { Badge } from '@/components/ui/Badge' import type { CampaignFormActionState } from '@/utilities/campaignFormActionError' import type { StaffPledgeRow } from '@/utilities/votePledgeData' const voteFormatter = new Intl.NumberFormat('pt-BR') const dateFormatter = new Intl.DateTimeFormat('pt-BR') type PlazaPledgesPanelProps = { pledges: StaffPledgeRow[] estimateFormAction: ( state: CampaignFormActionState, formData: FormData, ) => Promise } /** Staff-only: declared vs estimated votes per leadership in this plaza. */ export const PlazaPledgesPanel = ({ pledges, estimateFormAction }: PlazaPledgesPanelProps) => { const declaredTotal = pledges.reduce((total, pledge) => total + pledge.declaredVotes, 0) const effectiveTotal = pledges.reduce( (total, pledge) => total + (pledge.estimatedVotes ?? pledge.declaredVotes), 0, ) return (

Votos declarados pelas lideranças

A liderança informa quantos votos traz; a assessoria registra a estimativa real. A liderança nunca vê o valor estimado.

{pledges.length ? ( <>
Total declarado
{voteFormatter.format(declaredTotal)}
Total estimado
{voteFormatter.format(effectiveTotal)}
) : (

Nenhuma liderança declarou votos nesta Praça ainda.

)}
) }