import { contentPieceMediaKind, type ContentPiecePublicItem } from '@/lib/contentPieceCatalog' import { cn } from '@/lib/utils' /** * S27 — the piece asset (artefato: cenas 01/02/03/07): a photo previews, a * text shows its opening, a video/audio only mounts the media element after * the voter taps play (`preload="none"`, nothing is fetched before the * gesture) and a link piece shows where it lives. The owner of the play state * is the host (catalogue keeps one at a time; the piece page keeps its own). */ const PlayIcon = () => ( ) const PlayButton = ({ label, onToggle }: { label: string; onToggle: () => void }) => ( ) const DurationBadge = ({ label }: { label: string | null }) => label ? ( {label} ) : null export const ContentPieceMedia = ({ item, playing, onToggle, onEnded, variant = 'card', className, }: { item: ContentPiecePublicItem playing: boolean onToggle: () => void onEnded: () => void variant?: 'card' | 'thumb' | 'detail' className?: string }) => { const kind = contentPieceMediaKind(item) const base = cn('relative overflow-hidden bg-(--campaign-band)', className) if (kind === null) { return (
) } if (kind === 'image') { return (
{/* eslint-disable-next-line @next/next/no-img-element -- private proxy path with on-demand headers */} {item.title}
) } if (kind === 'text') { return (

“{item.excerpt ?? item.title}”

) } if (kind === 'video' || kind === 'audio') { if (playing) { return (
{kind === 'video' ? (
) } return (
{item.typeLabel}
) } return (

{item.file ? 'Baixe a peça para ver o arquivo.' : 'Sem arquivo para pré-visualizar.'}

) }