'use client' import { ReelStatusBadge } from '@/components/campaign/reels/ReelStatusBadge' import { usePublicationToggle } from '@/components/campaign/shared/usePublicationToggle' import { Alert, AlertDescription } from '@/components/ui/Alert' import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from '@/components/ui/AlertDialog' import { Button } from '@/components/ui/button' import { Spinner } from '@/components/ui/Spinner' import { campaignReelPublicationHref } from '@/lib/campaignPaths' import type { ReelStatus } from '@/lib/reel' type ReelPublicationPanelProps = { reelId: number status: ReelStatus } const UNPUBLISH_WARNING = 'Despublicar tira este reel da lista e bloqueia o player e os downloads. Os arquivos voltam a ficar disponíveis quando o reel for republicado.' const PUBLISH_WARNING = 'Republicar devolve o reel à lista e libera novamente o player e os downloads.' /** * C194 — the kill switch on the reel detail. Publishing puts the same row back * on the list and reopens the files; unpublishing takes it off the list and * withholds every file (C193 serves only `published`). Confirmation only on * the destructive direction. */ export const ReelPublicationPanel = ({ reelId, status }: ReelPublicationPanelProps) => { const { submitting, error, setPublished } = usePublicationToggle({ href: campaignReelPublicationHref(reelId), buildBody: (published) => ({ reelId, published }), }) return (

Publicação na biblioteca

{status === 'published' ? ( <>

{UNPUBLISH_WARNING}

Despublicar este reel? {UNPUBLISH_WARNING} Cancelar ) : null} {status === 'unpublished' ? ( <>

{PUBLISH_WARNING}

) : null} {status === 'draft' ? ( <>

Este reel ainda não foi publicado na biblioteca.

) : null} {error ? ( {error} ) : null}
) }