import { ArrowRightIcon } from 'lucide-react' import Link from 'next/link' import type { ReactNode } from 'react' import { CampaignMetricStrip } from '@/components/campaign/CampaignMetricStrip' import { CampaignPageShell, campaignPrioritySurfaceClassName, } from '@/components/campaign/CampaignPageShell' import { RecentlyVisitedCard } from '@/components/campaign/RecentlyVisitedCard' import { Badge } from '@/components/ui/Badge' import { Button } from '@/components/ui/button' import { formatElectionNumber } from '@/lib/electionInsights' import type { StaffDashboardView } from '@/utilities/campaignDashboardData' import { formatVoteEstimateEndpointsLabel, voteEstimateScenarioLabels, } from '@/utilities/voteEstimate' const dateTimeFormatter = new Intl.DateTimeFormat('pt-BR', { dateStyle: 'short', timeStyle: 'short', }) export const CampaignDashboard = ({ view, userName, mapSlot = null, }: { view: StaffDashboardView userName: string /** Server-streamed map section (composition keeps this component map-agnostic). */ mapSlot?: ReactNode }) => (

Olá, {userName}

{view.role === 'advisor' ? 'Quadro das Praças sob sua assessoria.' : 'Quadro geral da campanha por Praça.'}

{mapSlot}
0 ? Math.round((view.withAdvisorCount / view.municipalityCount) * 100) : undefined, }, { label: 'Declarações sem estimativa', value: formatElectionNumber(view.missingEstimateCount), }, ]} />

Declarações aguardando estimativa

{view.missingEstimateCount}
{view.missingEstimates.length ? (
    {view.missingEstimates.map((item) => (
  • {item.contactName} {item.municipalityName} · declarou {formatElectionNumber(item.declaredVotes)}{' '} votos
  • ))}
) : (

Todas as declarações do seu escopo têm estimativa registrada.

)}

Últimas atualizações de campo

{view.recentUpdates.length ? (
    {view.recentUpdates.map((update) => (
  • {update.municipalityName} {update.authorName} · {dateTimeFormatter.format(new Date(update.createdAt))}
  • ))}
) : (

Nenhuma atualização registrada ainda.

)}
{view.priorityMunicipalities.length ? (

Praças prioritárias

) : null}
)