import type { ReactNode } from 'react'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog'; // Confirmation for the destructive and the irreversible-ish. Upstream routes every one of these through a // single dialog store with the same "are you sure" copy; this keeps the single gate but says what will // actually happen, because "are you sure?" on its own never told anyone anything. export type ConfirmState = { title: string; description: ReactNode; confirmLabel?: string; destructive?: boolean; onConfirm: () => void; } | null; export const ConfirmDialog = ({ state, onClose }: { state: ConfirmState; onClose: () => void }) => { if (!state) return null; return ( !open && onClose()}> {state.title} {state.description} Cancel { state.onConfirm(); onClose(); }} className={state.destructive ? 'bg-destructive text-destructive-foreground hover:bg-destructive/90' : ''} > {state.confirmLabel ?? 'Confirm'} ); };