diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx
index 3500b7cc1..271c1072c 100644
--- a/Client/src/Components/Sidebar/index.jsx
+++ b/Client/src/Components/Sidebar/index.jsx
@@ -1,13 +1,12 @@
import { useState } from "react";
import {
Box,
+ Collapse,
List,
ListItemButton,
ListItemIcon,
ListItemText,
ListSubheader,
- Menu,
- MenuItem,
Stack,
Tooltip,
Typography,
@@ -31,17 +30,33 @@ import Incidents from "../../assets/icons/incidents.svg?react";
import Integrations from "../../assets/icons/integrations.svg?react";
import PageSpeed from "../../assets/icons/page-speed.svg?react";
import Settings from "../../assets/icons/settings.svg?react";
-import Arrow from "../../assets/icons/down-arrow.svg?react";
+import ArrowDown from "../../assets/icons/down-arrow.svg?react";
+import ArrowUp from "../../assets/icons/up-arrow.svg?react";
import "./index.css";
const menu = [
- { name: "Monitors", path: "monitors", icon: },
+ {
+ name: "Dashboard",
+ icon: ,
+ nested: [
+ { name: "Monitors", path: "monitors", icon: },
+ { name: "Pagespeed", path: "pagespeed", icon: },
+ ],
+ },
{ name: "Incidents", path: "incidents", icon: },
{ name: "Status pages", path: "status", icon: },
{ name: "Maintenance", path: "maintenance", icon: },
- { name: "Page speed", path: "pagespeed", icon: },
{ name: "Integrations", path: "integrations", icon: },
+ {
+ name: "Account",
+ icon: ,
+ nested: [
+ { name: "Profile", path: "account/profile", icon: },
+ { name: "Password", path: "account/password", icon: },
+ { name: "Team", path: "account/team", icon: },
+ ],
+ },
];
const other = [
@@ -49,13 +64,6 @@ const other = [
{ name: "Settings", path: "settings", icon: },
];
-const icons = {
- Profile: ,
- Team: ,
- Password: ,
- Logout: ,
-};
-
/**
* @component
* Sidebar component serves as a sidebar containing a menu.
@@ -68,8 +76,8 @@ function Sidebar() {
const navigate = useNavigate();
const location = useLocation();
const dispatch = useDispatch();
- const [anchorElUser, setAnchorElUser] = useState(null);
const authState = useSelector((state) => state.auth);
+ const [open, setOpen] = useState({ Dashboard: false, Account: false });
// Initialize settings and update based on user role
let settings = ["Profile", "Password", "Team", "Logout"];
@@ -77,15 +85,6 @@ function Sidebar() {
settings = ["Profile", "Password", "Logout"];
}
- /**
- * Handles opening the user menu.
- *
- * @param {React.MouseEvent} event - The event triggered by clicking the user menu button.
- */
- const handleOpenUserMenu = (event) => {
- setAnchorElUser(event.currentTarget);
- };
-
/**
* Handles logging out the user
*
@@ -97,29 +96,6 @@ function Sidebar() {
navigate("/login");
};
- /**
- * Handles closing the user menu.
- */
- const handleCloseUserMenu = (setting) => {
- setAnchorElUser(null);
- switch (setting) {
- case "Profile":
- navigate("/account/profile");
- break;
- case "Team":
- navigate("/account/team");
- break;
- case "Password":
- navigate("/account/password");
- break;
- case "Logout":
- logout();
- break;
- default:
- break;
- }
- };
-
return (
@@ -136,22 +112,68 @@ function Sidebar() {
}
sx={{ width: "100%" }}
>
- {menu.map((item) => (
- navigate(`/${item.path}`)}
- sx={{
- gap: theme.gap.medium,
- borderRadius: `${theme.shape.borderRadius}px`,
- }}
- >
- {item.icon}
- {item.name}
-
- ))}
+ {menu.map((item) =>
+ item.path ? (
+ navigate(`/${item.path}`)}
+ sx={{
+ gap: theme.gap.medium,
+ borderRadius: `${theme.shape.borderRadius}px`,
+ }}
+ >
+ {item.icon}
+ {item.name}
+
+ ) : (
+ <>
+
+ setOpen((prev) => ({
+ ...prev,
+ [`${item.name}`]: !prev[`${item.name}`],
+ }))
+ }
+ sx={{
+ gap: theme.gap.medium,
+ borderRadius: `${theme.shape.borderRadius}px`,
+ }}
+ >
+ {item.icon}
+ {item.name}
+ {open[`${item.name}`] ? : }
+
+
+
+ {item.nested.map((child) => (
+ navigate(`/${child.path}`)}
+ sx={{
+ gap: theme.gap.medium,
+ borderRadius: `${theme.shape.borderRadius}px`,
+ }}
+ >
+
+ {child.icon}
+
+ {child.name}
+
+ ))}
+
+
+ >
+ )
+ )}
{/* other */}
{authState.user?.firstName} {authState.user?.lastName}
-
-
);
}
diff --git a/Client/src/assets/icons/down-arrow.svg b/Client/src/assets/icons/down-arrow.svg
index 7c6a715ed..59b4b6bc5 100644
--- a/Client/src/assets/icons/down-arrow.svg
+++ b/Client/src/assets/icons/down-arrow.svg
@@ -1,3 +1,3 @@
diff --git a/Client/src/assets/icons/up-arrow.svg b/Client/src/assets/icons/up-arrow.svg
new file mode 100644
index 000000000..0f8f3bc34
--- /dev/null
+++ b/Client/src/assets/icons/up-arrow.svg
@@ -0,0 +1,3 @@
+