diff --git a/client/src/components/Canvas/CanvasComponents/DialogPopup.jsx b/client/src/components/Canvas/CanvasComponents/DialogPopup.jsx new file mode 100644 index 0000000..f7e90cf --- /dev/null +++ b/client/src/components/Canvas/CanvasComponents/DialogPopup.jsx @@ -0,0 +1,33 @@ +import { Dialog, Portal, CloseButton, Button } from "@chakra-ui/react"; + +export default function DialogPopup({dialog}) { + console.log("3. dialog popup") + return( + + + + + + + Leave Your Changes Behind? + + + + Click 'No' to go back and save your changes before navigating away from MyDashboard. + + + + + No + + Yes + + + + + + + + + ); +} \ No newline at end of file diff --git a/client/src/components/Dashboard.jsx b/client/src/components/Dashboard.jsx index 4d4aff0..093ae7f 100644 --- a/client/src/components/Dashboard.jsx +++ b/client/src/components/Dashboard.jsx @@ -34,15 +34,12 @@ export default function Dashboard() { // Prevent navigation while in Edit mode without saving or cancelling const handleViewChange = (nextView) => { + console.log("1. handling view change") if (view === "mydashboard" && isEditable) { - dialog.open(); - - - - - - - + console.log("2. currently editing"); + dialog.setOpen(true); + return; + // const confirmed = window.confirm( // "You have unsaved changes. Discard them and continue?" // ); @@ -62,6 +59,8 @@ export default function Dashboard() { const headerProps = { onChangeView: handleViewChange }; return ( + <> + + > ); } \ No newline at end of file
+ Click 'No' to go back and save your changes before navigating away from MyDashboard. +