import { useEffect, type ReactNode } from 'react'; export function Modal({ title, onClose, children, footer, wide, className, }: { title: string; onClose: () => void; children: ReactNode; footer?: ReactNode; wide?: boolean; className?: string; }) { useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); }, [onClose]); return (
e.target === e.currentTarget && onClose()}>

{title}

{children}
{footer &&
{footer}
}
); } export interface ConfirmRequest { title: string; message: ReactNode; confirmLabel: string; danger?: boolean; onConfirm: () => void | Promise; } export function ConfirmDialog({ req, onClose }: { req: ConfirmRequest; onClose: () => void }) { return ( } >

{req.message}

); }