'use client' import { CircleAlertIcon } from 'lucide-react' import { CampaignHoverTooltip } from '@/components/campaign/shared/CampaignHoverTooltip' import { Badge } from '@/components/ui/Badge' import { cn } from '@/lib/utils' import { formatTerritorialClassWhy, territorialClassBadgeVariant, territorialClassLabels, } from '@/utilities/municipality/municipalityLabels' import { formatMunicipalitySignalAgeLabel, isMunicipalitySignalCold, MUNICIPALITY_COLD_SIGNAL_DAYS, municipalitySignalAgeInDays, } from '@/utilities/municipality/municipalitySignal' import type { MunicipalityListViewModel } from '@/utilities/municipality/municipalityViewModels' const dateFormatter = new Intl.DateTimeFormat('pt-BR') /** E10 classe readout — shared by the table column and the mobile card (B42). */ export const TerritorialClassReadout = ({ municipality, }: { municipality: MunicipalityListViewModel }) => { const why = formatTerritorialClassWhy(municipality.territorialClassFactors) if (municipality.territorialClass === 'sem_base') { return ( {why} ) } return ( <> {territorialClassLabels[municipality.territorialClass]} {why} ) } /** E9 frescor readout — shared by the table column and the mobile card. */ export const SignalAgeReadout = ({ lastSignalAt, layout, }: { lastSignalAt: string | null layout: 'table' | 'card' }) => { const ageInDays = municipalitySignalAgeInDays(lastSignalAt) const isCold = isMunicipalitySignalCold(ageInDays) const ageLabel = formatMunicipalitySignalAgeLabel(ageInDays) const dateLabel = lastSignalAt ? dateFormatter.format(new Date(lastSignalAt)) : null return (
{isCold ? {dateLabel ? ( {dateLabel} ) : null}
) } export const TerritorialClassCardReadout = ({ municipality, }: { municipality: MunicipalityListViewModel }) => ( )