frontend validation

This commit is contained in:
EthanHealy01 2025-12-17 16:24:44 +00:00
parent 10fea78308
commit a17d36a90b
2 changed files with 22 additions and 3 deletions

View File

@ -7,9 +7,10 @@ import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline";
interface NavigationWarningModalProps {
onApplyAndContinue?: () => Promise<void>;
onExportAndContinue?: () => Promise<void>;
}
const NavigationWarningModal = ({ onApplyAndContinue }: NavigationWarningModalProps) => {
const NavigationWarningModal = ({ onApplyAndContinue, onExportAndContinue }: NavigationWarningModalProps) => {
const { t } = useTranslation();
const { showNavigationWarning, hasUnsavedChanges, pendingNavigation, cancelNavigation, confirmNavigation, setHasUnsavedChanges } =
useNavigationGuard();
@ -31,6 +32,14 @@ const NavigationWarningModal = ({ onApplyAndContinue }: NavigationWarningModalPr
confirmNavigation();
};
const handleExportAndContinue = async () => {
if (onExportAndContinue) {
await onExportAndContinue();
}
setHasUnsavedChanges(false);
confirmNavigation();
};
const BUTTON_WIDTH = "12rem";
// Only show modal if there are unsaved changes AND there's an actual pending navigation
@ -75,6 +84,11 @@ const NavigationWarningModal = ({ onApplyAndContinue }: NavigationWarningModalPr
{t("applyAndContinue", "Apply & Leave")}
</Button>
)}
{onExportAndContinue && (
<Button variant="filled" onClick={handleExportAndContinue} w={BUTTON_WIDTH} leftSection={<CheckCircleOutlineIcon fontSize="small" />}>
{t("exportAndContinue", "Export & Leave")}
</Button>
)}
</Group>
</Group>
@ -91,6 +105,11 @@ const NavigationWarningModal = ({ onApplyAndContinue }: NavigationWarningModalPr
{t("applyAndContinue", "Apply & Leave")}
</Button>
)}
{onExportAndContinue && (
<Button variant="filled" onClick={handleExportAndContinue} w={BUTTON_WIDTH} leftSection={<CheckCircleOutlineIcon fontSize="small" />}>
{t("exportAndContinue", "Export & Leave")}
</Button>
)}
</Stack>
</Stack>
</Modal>

View File

@ -34,8 +34,8 @@ export const useRedactParameters = (): RedactParametersHook => {
if (params.mode === 'automatic') {
return '/api/v1/security/auto-redact';
}
// Manual redaction is handled in the viewer; no endpoint
return null;
// Manual redaction handled client-side
return '';
},
validateFn: (params) => {
if (params.mode === 'automatic') {