import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@repo/shadcn-ui/components"; import { useState } from 'react'; interface CustomDialogProps { open: boolean; onConfirm: (ok: boolean) => void; title?: string; description?: string; cancelLabel?: string; confirmLabel?: string; } export const CustomDialog = ({ open, onConfirm, title, description, cancelLabel, confirmLabel, }: CustomDialogProps) => { const [closedByAction, setClosedByAction] = useState(false); const handleClose = (ok: boolean) => { setClosedByAction(true); onConfirm(ok); }; return ( { if (!nextOpen && !closedByAction) onConfirm(false); if (nextOpen) setClosedByAction(false); }} > {title} {description} {cancelLabel} {confirmLabel} ); };