import { EllipsisVertical, Trash, Copy } from "lucide-react"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "../ui/dropdown-menu"; import { Button } from "../ui/button"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "../ui/alert-dialog"; import { useState, useEffect } from "react"; import { useFetcher, useNavigate } from "@remix-run/react"; import { toast } from "~/hooks/use-toast"; interface LogOptionsProps { id: string; } export const LogOptions = ({ id }: LogOptionsProps) => { const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); const deleteFetcher = useFetcher<{ success: boolean }>(); const navigate = useNavigate(); const handleDelete = () => { deleteFetcher.submit( { id }, { method: "DELETE", action: "/api/v1/ingestion_queue/delete", encType: "application/json", }, ); setDeleteDialogOpen(false); }; const handleCopy = async () => { try { await navigator.clipboard.writeText(id); toast({ title: "Copied", description: "Episode ID copied to clipboard", }); } catch (err) { console.error("Failed to copy:", err); toast({ title: "Error", description: "Failed to copy ID", variant: "destructive", }); } }; useEffect(() => { if (deleteFetcher.state === "idle" && deleteFetcher.data?.success) { navigate(`/home/inbox`); } }, [deleteFetcher.state, deleteFetcher.data]); return ( <>