import { useTranslation } from "react-i18next"; import { I18nKey } from "#/i18n/declaration"; import { BrandButton } from "#/components/features/settings/brand-button"; import { ModalBackdrop } from "./modal-backdrop"; interface ConfirmationModalProps { text: string; onConfirm: () => void; onCancel: () => void; confirmText?: string; /** * Disables both action buttons while an asynchronous confirm * mutation is in flight. Defaults to false to preserve existing * call sites that don't track mutation state. */ isConfirming?: boolean; } export function ConfirmationModal({ text, onConfirm, onCancel, confirmText, isConfirming = false, }: ConfirmationModalProps) { const { t } = useTranslation("openhands"); // Suppress the backdrop's click / Escape close handler while the // confirm mutation is in flight; otherwise the user could dismiss // the modal mid-request and never see the result (the buttons are // already disabled, but the backdrop wasn't). return (

{text}

{t(I18nKey.BUTTON$CANCEL)} {confirmText ?? t(I18nKey.BUTTON$CONFIRM)}
); }