import { addUpdateCommentFormAction, assignUpdateResponsibleFormAction, markUpdateReopenedFormAction, markUpdateResolvedFormAction, } from '@/app/(campaign)/campanha/actions/municipalityUpdateDeliberation' import { MunicipalityUpdateDeliberation, type MunicipalityUpdateDeliberationFormActions, } from '@/components/campaign/municipality/MunicipalityUpdateDeliberation' import { Badge } from '@/components/ui/Badge' import { municipalityUpdatePolarityBadgeVariant, municipalityUpdatePolarityLabels, } from '@/lib/schemas/municipalityUpdate' import type { MunicipalityUpdateDeliberationContext, MunicipalityUpdateViewModel, } from '@/utilities/municipality/municipalityUpdatePageData' const deliberationFormActions: MunicipalityUpdateDeliberationFormActions = { assign: assignUpdateResponsibleFormAction, comment: addUpdateCommentFormAction, resolve: markUpdateResolvedFormAction, reopen: markUpdateReopenedFormAction, } const dateTimeFormatter = new Intl.DateTimeFormat('pt-BR', { dateStyle: 'short', timeStyle: 'short', }) const numberFormatter = new Intl.NumberFormat('pt-BR') export const MunicipalityUpdateFeed = ({ updates, deliberation, }: { updates: MunicipalityUpdateViewModel[] deliberation: MunicipalityUpdateDeliberationContext }) => { if (!updates.length) { return (
Nenhuma atualização registrada ainda.
) } return ({update.body ?? 'Sem texto.'}
{update.activeVolunteers != null || update.newSupports != null ? ({update.activeVolunteers != null ? `${numberFormatter.format(update.activeVolunteers)} voluntários ativos` : null} {update.activeVolunteers != null && update.newSupports != null ? ' · ' : null} {update.newSupports != null ? `${numberFormatter.format(update.newSupports)} novos apoios` : null}
) : null} {deliberation ? (