diff --git a/client/src/components/layout/Canvas/views/DashboardCanvas.jsx b/client/src/components/layout/Canvas/views/DashboardCanvas.jsx
index b27c5b5..0e11076 100644
--- a/client/src/components/layout/Canvas/views/DashboardCanvas.jsx
+++ b/client/src/components/layout/Canvas/views/DashboardCanvas.jsx
@@ -11,11 +11,8 @@ import { CancelButton } from "../components/CancelButton";
import { SaveButton } from "../components/SaveButton";
import DeleteAllButton from "../components/DeleteAllButton";
-export function DashboardCanvas({ onCancel, isEditable, setIsEditable, isDelete, setIsDelete, view, setView, layout, setLayout, originalLayout, setOriginalLayout, onLayoutChange, onChangeView }) {
- // const [isEditable, setIsEditable] = useState(false); // editable=true means static=false (vice versa)
- // const [isDelete, setIsDelete] = useState(false);
+export function DashboardCanvas({ onCancel, isEditable, setIsEditable, isDelete, setIsDelete, view, layout, setLayout, originalLayout, setOriginalLayout, onLayoutChange, onChangeView }) {
const [newCounter, setNewCounter] = useState(3);
- // const [originalLayout, setOriginalLayout] = useState([]);
const onAddWidget = () => {
const newId = newCounter.toString();
@@ -55,20 +52,6 @@ export function DashboardCanvas({ onCancel, isEditable, setIsEditable, isDelete,
setOriginalLayout([]) // Clear backup layout
}
- // Lifting up to Dashboard.jsx for prop drilling
- // const onCancel = () => {
- // console.log("canceling changes...");
- // if (originalLayout.length) {
- // setLayout(originalLayout.map(item => ({
- // ...item,
- // static: true
- // })));
- // };
- // setIsEditable(false);
- // setIsDelete(false);
- // setOriginalLayout([]);
- // }
-
const onDeleteWidgets = () => {
console.log("Start deleting widgets...");
setOriginalLayout(layout);
@@ -102,14 +85,6 @@ export function DashboardCanvas({ onCancel, isEditable, setIsEditable, isDelete,
onValueChange={(e) => {
const nextView = e.value;
onChangeView(nextView);
- // 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);
}}
>
diff --git a/client/src/components/layout/Header/Header.jsx b/client/src/components/layout/Header/Header.jsx
index d2c3fa4..1c127a7 100644
--- a/client/src/components/layout/Header/Header.jsx
+++ b/client/src/components/layout/Header/Header.jsx
@@ -8,7 +8,7 @@ const user = {
// avatar: "src\\assets\\user_profile.svg"
}
-export default function Header({ view, setView, onChangeView }) {
+export default function Header({ onChangeView }) {
const recipe = useRecipe({ key: "header" });
const styles = recipe();
@@ -23,8 +23,6 @@ export default function Header({ view, setView, onChangeView }) {
diff --git a/client/src/components/layout/Header/UserAvatarMenu.jsx b/client/src/components/layout/Header/UserAvatarMenu.jsx
index 3158e89..b7d29bc 100644
--- a/client/src/components/layout/Header/UserAvatarMenu.jsx
+++ b/client/src/components/layout/Header/UserAvatarMenu.jsx
@@ -1,7 +1,7 @@
import { Avatar, Menu, Portal, Box } from "@chakra-ui/react"
-export default function UserAvatarMenu({ view, setView, onChangeView, name, avatar }) {
+export default function UserAvatarMenu({ onChangeView, name, avatar }) {
return (
diff --git a/client/src/components/layout/Sidebar/Sidebar.jsx b/client/src/components/layout/Sidebar/Sidebar.jsx
index 4d7ee4b..9af13a2 100644
--- a/client/src/components/layout/Sidebar/Sidebar.jsx
+++ b/client/src/components/layout/Sidebar/Sidebar.jsx
@@ -1,6 +1,5 @@
import { useSlotRecipe, Box, Button, IconButton } from "@chakra-ui/react";
import { ColorModeButton, useColorMode } from "@/components/ui/color-mode";
-// import { Tooltip } from "@/components/ui/tooltip";
import Tooltip from "../Canvas/components/Tooltip.jsx";
import { FaVolcano } from "react-icons/fa6";
import { FaHome } from "react-icons/fa";
@@ -9,7 +8,6 @@ import { FaMapMarkerAlt } from "react-icons/fa";
import { HiUsers } from "react-icons/hi2";
import { VscThreeBars } from "react-icons/vsc";
import { useState, useEffect } from "react";
-import { Seismic } from "../Canvas/views/DashboardCanvasNav/Seismic";
import { DASHBOARD_VIEWS } from "@/constants/viewKeys";
export default function Sidebar({ view, onChangeView, darkMode, setDarkMode }) {
@@ -35,14 +33,13 @@ export default function Sidebar({ view, onChangeView, darkMode, setDarkMode }) {
// Track currrent view from both Sidebar and Canvas when 'view' changes
useEffect(() => {
- // console.log("typeof view =", typeof view);
console.log("Current view = ", view);
const newIndex = buttons.findIndex((btn) => {
if (btn.view === "widget") {
- return DASHBOARD_VIEWS.includes(view); // Group match
+ return DASHBOARD_VIEWS.includes(view);
}
- return btn.view === view; // Exact match
+ return btn.view === view;
});
if (newIndex !== -1 ) {
@@ -52,7 +49,6 @@ export default function Sidebar({ view, onChangeView, darkMode, setDarkMode }) {
return (
{
- // setActiveButton(idx);
onChangeView(button.view); // Trigger state change in Dashboard
}}
bg={activeButton === idx ? "primary":undefined}