diff --git a/webui/src/states/Root/components/Sidebar/Sidebar.jsx b/webui/src/states/Root/components/Sidebar/Sidebar.jsx new file mode 100644 index 0000000..1087da6 --- /dev/null +++ b/webui/src/states/Root/components/Sidebar/Sidebar.jsx @@ -0,0 +1,67 @@ +import { + Divider, Drawer, + List, + ListItem, + ListItemButton, + ListItemIcon, + ListItemText, + Stack, + Toolbar, + Typography +} from "@mui/material"; +import {sidebar} from "@/common/routes/server.jsx"; +import {useLocation, useNavigate} from "react-router-dom"; + +const drawerWidth = 240; + +export const Sidebar = ({mobileOpen, toggleOpen, window: containerWindow}) => { + const location = useLocation(); + const navigate = useNavigate(); + + const container = containerWindow !== undefined ? () => containerWindow().document.body : undefined; + + const isSelected = (path) => { + if (path === "/") return location.pathname === "/"; + + return location.pathname.startsWith(path); + } + + const drawer = ( + <> + + + MCDash + MCDash + + + + + + + {sidebar.map((route) => ( + + navigate(route.path.replace("/*", ""))}> + {route.icon} + + + + ))} + + + + ); + + return ( + <> + + {drawer} + + + {drawer} + + + ) +} \ No newline at end of file