'use client' import { PlayIcon } from 'lucide-react' import Link from 'next/link' import { useEffect, useState } from 'react' import { SpeechCutDeleteDialog } from '@/components/campaign/speech/SpeechCutDeleteDialog' import { SpeechCutRetryButton } from '@/components/campaign/speech/SpeechCutRetryButton' import { CopyLinkButton } from '@/components/CopyLinkButton' import { SpeechCutDownloadButton, SpeechCutWhatsAppButton, } from '@/components/SpeechCutShareActions' import { Button } from '@/components/ui/button' import { campaignSpeechCutDetailHref } from '@/lib/campaignPaths' import type { SpeechCutLibraryItemViewModel, SpeechCutStatus } from '@/lib/speechCut' /** * C183 — the library card's action row: the recovery of a failed cut comes * first and full width on mobile (Cena D), then open/copy, with delete * isolated at the right (desktop) or full width (mobile published). * * C217 — a published cut leads with the productive kit the artifact shows * (copy link primary, download, WhatsApp, scene 04/06); opening the cut and * deleting stay as the management row below. */ const deleteTriggerClassName = (status: SpeechCutStatus): string => status === 'published' ? 'w-full sm:ml-auto sm:w-auto' : 'flex-1 sm:ml-auto sm:flex-none' export const SpeechCutLibraryCardActions = ({ cut }: { cut: SpeechCutLibraryItemViewModel }) => { const [absoluteUrl, setAbsoluteUrl] = useState('') useEffect(() => { setAbsoluteUrl(new URL(cut.publicPath, window.location.origin).toString()) }, [cut.publicPath]) const shareUrl = absoluteUrl || cut.publicPath return (