import { useEffect } from 'react'; interface Props { open: boolean; title: string; onClose: () => void; children: React.ReactNode; footer?: React.ReactNode; } export function Modal({ open, title, onClose, children, footer }: Props) { useEffect(() => { if (!open) return; const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose(); window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); }, [open, onClose]); if (!open) return null; return (
e.stopPropagation()}>

{title}

{children} {footer &&
{footer}
}
); } /** Confirmation dialog with safe cancel default */ export function ConfirmDialog({ open, title, message, confirmLabel = 'Confirm', danger = false, onConfirm, onCancel, }: { open: boolean; title: string; message: string; confirmLabel?: string; danger?: boolean; onConfirm: () => void; onCancel: () => void; }) { return ( } >

{message}

); }