import Link from 'next/link' import { ContentPieceCirculationCounters } from '@/components/campaign/content/ContentPieceCirculationCounters' import { ContentPieceRetryButton } from '@/components/campaign/content/ContentPieceRetryButton' import { ContentPieceProcessingBadge, ContentPiecePublicationBadge, } from '@/components/campaign/content/ContentPieceStatusBadge' import { Button } from '@/components/ui/button' import { CONTENT_PIECE_LINK_LABEL, contentPieceStepLabels } from '@/lib/contentPiece' import type { ContentPieceRowViewModel } from '@/lib/contentPieceCirculation' /** * C211/C220 — the Central list on mobile (approved design scenes 5): one card * per piece with the title + processing state, the type/publication line and * the single "Abrir" (or "Reprocessar" when it failed). A link piece also * carries the neutral "Peça-link" label — the honest reason lives on the ficha, * never on the list (C220 D7). C213 adds the piece's circulation counters (2×2 * grid) right above the action. */ export const ContentPieceCardList = ({ rows, empty, }: { rows: readonly ContentPieceRowViewModel[] empty?: React.ReactNode }) => (
{rows.length === 0 && empty ? empty : null} {rows.map((piece) => { // A peça-link carries no honest type (the link may be a carousel) — the // neutral label replaces it (C220 D7, design scene 3). const isLinkOnly = piece.origin !== 'arquivo' && piece.processingStatus === 'pronto' && !piece.hasFile const meta = [ piece.origin !== 'arquivo' ? piece.originLabel : null, isLinkOnly ? CONTENT_PIECE_LINK_LABEL : null, ...(isLinkOnly ? [] : [piece.typeLabel, piece.durationLabel]), ] return (
{piece.title}
{meta.filter(Boolean).join(' · ')} {piece.cityLabel ? ` · ${piece.cityLabel}` : ''}
{piece.processingStatus === 'processando' ? ( <>

{piece.step ? contentPieceStepLabels[piece.step] : 'Processando…'}

) : piece.processingStatus === 'falhou' && piece.failureMessage ? (

{piece.failureMessage}

) : null} {piece.canRetry ? ( ) : ( )}
) })}
)