import { t } from '../i18n' import { useEffect } from 'react' interface Props { open: boolean title: string message?: string confirmLabel?: string onConfirm: () => void onCancel: () => void } /** Fenêtre « Êtes-vous sûr ? » intégrée à l'app (plus fiable que window.confirm sur mobile). */ export default function ConfirmDialog({ open, title, message, confirmLabel = t('common.confirm'), onConfirm, onCancel }: Props) { useEffect(() => { if (!open) return const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onCancel() window.addEventListener('keydown', onKey) return () => window.removeEventListener('keydown', onKey) }, [open, onCancel]) if (!open) return null return (
{message}
}