import { hasAnyEstimate, PledgeEstimateForm } from '@/components/campaign/PledgeEstimateForm' import { Badge } from '@/components/ui/Badge' import type { CampaignFormActionState } from '@/utilities/campaignFormActionError' import { effectivePledgeVotesForScenario, formatVoteEstimateRange, getVoteEstimateForScenario, } from '@/utilities/voteEstimate' 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 + effectivePledgeVotesForScenario(pledge.declaredVotes, pledge.estimatedVotes, 'central'), 0, ) return (

Votos declarados pelas lideranças

A liderança informa quantos votos traz; a assessoria registra a estimativa real em três cenários. A liderança nunca vê o valor estimado.

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

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

)}
) }