diff --git a/client/src/components/layout/Canvas/Canvas.jsx b/client/src/components/layout/Canvas/Canvas.jsx index 9280c4b..d94300e 100644 --- a/client/src/components/layout/Canvas/Canvas.jsx +++ b/client/src/components/layout/Canvas/Canvas.jsx @@ -16,7 +16,7 @@ export default function Canvas({ view, setView, layout, setLayout, onLayoutChang return ( - {/* {view === "widget" && */} + {/* Check if view is a tab inside the Canvas Header */} { DASHBOARD_VIEWS.includes(view) && ( setView(e.value)} // onValueChange={(value) => setView(value)} + // onValueChange={(e) => setView(e.value)} + onValueChange={(e) => { + const nextView = e.value; + + if (view === "widget" && isEditable && nextView !== "widget") { + const confirmed = window.confirm( + "You have unsaved changes. Do you wish to discard them and continue?" + ); + if (!confirmed) return; + onCancel(); + } + setView(nextView); + }} >