import Link from 'next/link' import { CampaignDataFreshness } from '@/components/campaign/CampaignDataFreshness' import { CampaignMetricStrip, type CampaignMetric } from '@/components/campaign/CampaignMetricStrip' import { campaignPrioritySurfaceClassName } from '@/components/campaign/CampaignPageShell' import { Badge } from '@/components/ui/Badge' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Progress } from '@/components/ui/Progress' import { formatElectionNumber } from '@/lib/electionInsights' import { actionPlanKindLabels } from '@/lib/schemas/actionPlan' import { formatBahiaDateTimeLabel } from '@/utilities/campaignTime' import { formatRelativeAge } from '@/utilities/formatRelativeAge' import type { NucleusListOverviewViewModel } from '@/utilities/nucleusListOverviewViewModels' import { nucleusUpdateKindLabels } from '@/utilities/nucleusUpdateUi' const numberFormatter = new Intl.NumberFormat('pt-BR') export const NucleusListOverview = ({ view, now, }: { view: NucleusListOverviewViewModel now: Date }) => { const secondaryMetrics: CampaignMetric[] = [ { label: 'Cobertura com coordenador', value: `${view.coverage.percent}%`, progress: view.coverage.percent, }, { label: 'Meta regular 2026', value: numberFormatter.format(view.voteGoals.regular), }, ] return (

Visão geral dos núcleos filtrados

Mostrando agregados de{' '} {numberFormatter.format(view.totalFiltered)} {' '} {view.totalFiltered === 1 ? 'núcleo filtrado' : 'núcleos filtrados'}

Estimativa de votos (prioridade) {numberFormatter.format(view.estimate.confirmedTotal)}
{view.estimate.confirmedPercent}% com estimativa confirmada {numberFormatter.format(view.estimate.confirmedCount)} confirmadas ·{' '} {numberFormatter.format(view.estimate.unconfirmedCount)} pendentes
{view.estimate.pendingSuggestionsCount ? ( {numberFormatter.format(view.estimate.pendingSuggestionsCount)}{' '} {view.estimate.pendingSuggestionsCount === 1 ? 'sugestão pendente' : 'sugestões pendentes'} ) : null}

{numberFormatter.format(view.coverage.coordinatedCount)} de{' '} {numberFormatter.format(view.totalFiltered)} com coordenador {view.highPriorityCount > 0 ? ` · ${numberFormatter.format(view.highPriorityCount)} prioritários` : ''}

{view.baseline2022 && view.baseline2022.gapTotal !== null ? (

Baseline 2022:{' '} {numberFormatter.format(view.baseline2022.above)} acima {' · '} {numberFormatter.format(view.baseline2022.below)} abaixo {' · '} {view.baseline2022.gapTotal >= 0 ? '+' : ''} {numberFormatter.format(view.baseline2022.gapTotal)} gap

) : null} {view.trend ? (

Tendência:{' '} {formatElectionNumber(view.trend.increase)} aumento {' · '} {formatElectionNumber(view.trend.stable)} mantém {' · '} {formatElectionNumber(view.trend.decline)} queda

) : null}

Demais indicadores

Últimas atualizações {view.recentUpdates.length ? (
    {view.recentUpdates.map((update) => (
  • {update.authorName} {nucleusUpdateKindLabels[update.kind]} {formatRelativeAge(new Date(update.createdAt).getTime(), now.getTime())}
    {update.nucleusName}
  • ))}
) : (

Nenhuma atualização recente

)}
Próximos eventos {view.upcomingActionPlans.length ? (
    {view.upcomingActionPlans.map((plan) => (
  • {actionPlanKindLabels[plan.kind]} {formatBahiaDateTimeLabel(plan.startAt)} {plan.city ? ` · ${plan.city}` : ''}
    {plan.title}
  • ))}
) : (

Nenhum evento agendado

)}
) }