mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-29 09:03:08 +00:00
- CSS de página (padrão C101): .campaign-updates-filter-strip sticky sob a top bar com linha separadora, :has() zera o padding-top do scroll container - Chassis B127 ganha o hook estável data-slot=campaign-omnibox-field (sem mudança de comportamento) - 'Nova atualização' vira icon no header via SetCampaignHeaderAction (slot C94/C95), gate de resolução 100% CSS (md:hidden); mesmo modal C89 - Cards edge-to-edge (-mx-4) sem borda, divisor de linha; corrigido o leak do @layer base editorial (ul my-6 ml-6 [&>li]:mt-2) que afetava a única lista campaign em <ul> - Empty state com copy única descrevendo a ação - E2E campaignUpdatesMobile (mobile + regressão desktop); impl plan + changelog
63 lines
2.3 KiB
TypeScript
63 lines
2.3 KiB
TypeScript
import { Inbox } from 'lucide-react'
|
|
|
|
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
|
import { CampaignUserAvatar } from '@/components/campaign/shared/CampaignUserAvatar'
|
|
import { Badge } from '@/components/ui/Badge'
|
|
import {
|
|
municipalityUpdatePolarityBadgeVariant,
|
|
municipalityUpdatePolarityLabels,
|
|
} from '@/lib/schemas/municipalityUpdate'
|
|
import type { CampaignUpdatesFeedCard } from '@/utilities/municipality/campaignUpdatesFeedData'
|
|
|
|
const dateTimeFormatter = new Intl.DateTimeFormat('pt-BR', {
|
|
dateStyle: 'short',
|
|
timeStyle: 'short',
|
|
})
|
|
|
|
const CampaignUpdatesFeedItem = ({ card }: { card: CampaignUpdatesFeedCard }) => (
|
|
<li className="flex gap-3 rounded-none border-b border-border p-4 last:border-b-0 md:rounded-xl md:border md:last:border-b">
|
|
<CampaignUserAvatar
|
|
name={card.author.name}
|
|
avatarUrl={card.author.avatarUrl}
|
|
size="default"
|
|
className="mt-0.5 size-10 shrink-0"
|
|
/>
|
|
<div className="flex min-w-0 flex-1 flex-col gap-2">
|
|
<p className="whitespace-pre-wrap text-sm">{card.body ?? 'Sem texto.'}</p>
|
|
<div className="flex flex-wrap gap-1.5">
|
|
<Badge variant={municipalityUpdatePolarityBadgeVariant[card.polarity]}>
|
|
{municipalityUpdatePolarityLabels[card.polarity]}
|
|
</Badge>
|
|
{card.urgent ? <Badge variant="destructive">Urgente</Badge> : null}
|
|
{card.adversarySignal ? <Badge variant="outline">Adversário</Badge> : null}
|
|
</div>
|
|
<p className="text-xs text-muted-foreground">
|
|
<span className="font-medium text-foreground">{card.author.name}</span>
|
|
<span aria-hidden="true"> · </span>
|
|
{card.municipality.name}
|
|
<span aria-hidden="true"> · </span>
|
|
{dateTimeFormatter.format(new Date(card.createdAt))}
|
|
</p>
|
|
</div>
|
|
</li>
|
|
)
|
|
|
|
export const CampaignUpdatesFeed = ({ cards }: { cards: CampaignUpdatesFeedCard[] }) => {
|
|
if (cards.length === 0) {
|
|
return (
|
|
<CampaignListEmptyState
|
|
icon={Inbox}
|
|
title="Nenhuma atualização encontrada"
|
|
description="Ajuste o filtro ou registre um novo fato de campo."
|
|
/>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<ul className="-mx-4 my-0 flex list-none flex-col [&>li]:mt-0 md:mx-0 md:gap-4">
|
|
{cards.map((card) => (
|
|
<CampaignUpdatesFeedItem key={card.id} card={card} />
|
|
))}
|
|
</ul>
|
|
)
|
|
}
|