import { useEffect } from 'react'; import { createPortal } from 'react-dom'; import { Button } from '@/components/ui/button'; import { KeyHint } from '@/components/key-hint'; interface ConfirmDestructiveOverlayProps { title: string; description: React.ReactNode; confirmLabel: string; pendingLabel?: string; isPending: boolean; onConfirm: () => void; onClose: () => void; } export function ConfirmDestructiveOverlay({ title, description, confirmLabel, pendingLabel = 'Working…', isPending, onConfirm, onClose, }: ConfirmDestructiveOverlayProps) { useEffect(() => { const handler = (e: KeyboardEvent) => { if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); onClose(); } }; window.addEventListener('keydown', handler, { capture: true }); return () => window.removeEventListener('keydown', handler, { capture: true }); }, [onClose]); return createPortal(

{title}

to close
{description}
, document.body, ); }