-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2555 from bcgov/feature/DESENG-655-add-existing-f…
…ields-to-engagement-wizard [To Main] DESENG-655: Add existing engagement fields to engagement wizard
- Loading branch information
Showing
26 changed files
with
17,308 additions
and
9,864 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
met-web/src/components/common/Navigation/UnsavedWorkConfirmation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Modal } from '@mui/material'; | ||
import React from 'react'; | ||
import { useBlocker } from 'react-router-dom'; | ||
import ConfirmModal from '../Modals/ConfirmModal'; | ||
|
||
interface UnsavedWorkConfirmationProps { | ||
blockNavigationWhen: boolean; | ||
} | ||
|
||
const UnsavedWorkConfirmation: React.FC<UnsavedWorkConfirmationProps> = ({ blockNavigationWhen }) => { | ||
const blocker = useBlocker( | ||
({ currentLocation, nextLocation }) => | ||
blockNavigationWhen && nextLocation.pathname !== currentLocation.pathname, | ||
); | ||
|
||
return ( | ||
<Modal open={blocker.state === 'blocked'} onClose={blocker.reset}> | ||
<ConfirmModal | ||
style="warning" | ||
header="Unsaved Changes" | ||
subHeader="Are you sure you want to leave this page?" | ||
subText={[{ text: 'If you leave this page, your changes will be lost.' }]} | ||
cancelButtonText="Stay" | ||
confirmButtonText="Leave" | ||
handleClose={blocker.reset} | ||
handleConfirm={blocker.proceed} | ||
/> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default UnsavedWorkConfirmation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.