Files
webui/src/components/forms/UnsavedChangesDialog.tsx
T
2026-10-15 14:50:50 +02:00

25 lines
840 B
TypeScript

/*
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
import { useTranslation } from 'react-i18next';
import type { Blocker } from 'react-router-dom';
import { ConfirmDialog } from '@/components/common/ConfirmDialog';
export function UnsavedChangesDialog({ blocker }: { blocker: Blocker }) {
const { t } = useTranslation();
return (
<ConfirmDialog
open={blocker.state === 'blocked'}
title={t('form.unsavedChangesTitle', 'Unsaved changes')}
description={t('form.unsavedChanges', 'You have unsaved changes. Are you sure you want to leave?')}
cancelLabel={t('form.stay', 'Stay')}
confirmLabel={t('form.leave', 'Leave')}
onCancel={() => blocker.reset?.()}
onConfirm={() => blocker.proceed?.()}
/>
);
}