From f85c64e7f00f689a2c2bbdb9747f4e2b67c39c2e Mon Sep 17 00:00:00 2001 From: Venessa Kuchenik Date: Tue, 12 Aug 2025 09:55:57 -0700 Subject: [PATCH] Dialog popup works --- .../Canvas/CanvasComponents/DialogPopup.jsx | 33 +++++++++++++++++++ client/src/components/Dashboard.jsx | 16 ++++----- 2 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 client/src/components/Canvas/CanvasComponents/DialogPopup.jsx 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 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