diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx index ec374a008..6d5250a76 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/Client/src/Components/Sidebar/index.jsx @@ -183,7 +183,7 @@ function Sidebar() { This is the top lever for styles */ sx={{ - position: 'relative', + position: "relative", border: 1, borderColor: theme.palette.primary.lowContrast, borderRadius: theme.shape.borderRadius, @@ -304,86 +304,55 @@ function Sidebar() { - - Menu - - } sx={{ - px: theme.spacing(6), - height: "100%", - /* overflow: "hidden", */ + flexGrow: 1, + overflow: "auto", + overflowX: "hidden", + "&::-webkit-scrollbar": { + width: theme.spacing(2), + }, + "&::-webkit-scrollbar-thumb": { + backgroundColor: theme.palette.primary.lowContrast, + borderRadius: theme.spacing(4), + }, }} > - {menu.map((item) => { - if (item.path === "distributed-uptime" && distributedUptimeEnabled === false) { - return null; - } - return item.path ? ( - /* If item has a path */ - - navigate(`/${item.path}`)} - sx={{ - height: "37px", - gap: theme.spacing(4), - borderRadius: theme.shape.borderRadius, - px: theme.spacing(4), - }} - > - {item.icon} - {item.name} - - - ) : collapsed ? ( - /* TODO Do we ever get here? If item does not have a path and collapsed state is true */ - + Menu + + } + sx={{ + px: theme.spacing(6), + height: "100%", + /* overflow: "hidden", */ + }} + > + {menu.map((item) => { + if ( + item.path === "distributed-uptime" && + distributedUptimeEnabled === false + ) { + return null; + } + return item.path ? ( + /* If item has a path */ openPopup(event, item.name)} + onClick={() => navigate(`/${item.path}`)} sx={{ - position: "relative", + height: "37px", gap: theme.spacing(4), borderRadius: theme.shape.borderRadius, px: theme.spacing(4), @@ -416,104 +385,68 @@ function Sidebar() { {item.name} - - {item.nested.map((child) => { - if ( - child.name === "Team" && - authState.user?.role && - !authState.user.role.includes("superadmin") - ) { - return null; - } - - return ( - { - const url = URL_MAP[child.path]; - if (url) { - window.open(url, "_blank", "noreferrer"); - } else { - navigate(`/${child.path}`); - } - closePopup(); - }} - sx={{ - gap: theme.spacing(4), - opacity: 0.9, - /* TODO this has no effect? */ - "& svg": { - "& path": { - stroke: theme.palette.primary.contrastTextTertiary, - strokeWidth: 1.1, + ) : collapsed ? ( + /* TODO Do we ever get here? If item does not have a path and collapsed state is true */ + + - {child.icon} - {child.name} - - ); - })} - - - ) : ( - /* TODO Do we ever get here? If item does not have a path and collapsed state is false */ - - - setOpen((prev) => ({ - ...Object.fromEntries(Object.keys(prev).map((key) => [key, false])), - [item.name]: !prev[item.name], - })) - } - sx={{ - gap: theme.spacing(4), - borderRadius: theme.shape.borderRadius, - px: theme.spacing(4), - }} - > - {item.icon} - {item.name} - {open[`${item.name}`] ? : } - - - + openPopup(event, item.name)} + sx={{ + position: "relative", + gap: theme.spacing(4), + borderRadius: theme.shape.borderRadius, + px: theme.spacing(4), + }} + > + {item.icon} + {item.name} + + + {item.nested.map((child) => { if ( @@ -525,7 +458,7 @@ function Sidebar() { } return ( - - {child.icon} - {child.name} - + {child.icon} + {child.name} + ); })} - - - - ); - })} - + + + ) : ( + /* TODO Do we ever get here? If item does not have a path and collapsed state is false */ + + + setOpen((prev) => ({ + ...Object.fromEntries(Object.keys(prev).map((key) => [key, false])), + [item.name]: !prev[item.name], + })) + } + sx={{ + gap: theme.spacing(4), + borderRadius: theme.shape.borderRadius, + px: theme.spacing(4), + }} + > + {item.icon} + {item.name} + {open[`${item.name}`] ? : } + + + + {item.nested.map((child) => { + if ( + child.name === "Team" && + authState.user?.role && + !authState.user.role.includes("superadmin") + ) { + return null; + } + + return ( + { + const url = URL_MAP[child.path]; + if (url) { + window.open(url, "_blank", "noreferrer"); + } else { + navigate(`/${child.path}`); + } + }} + sx={{ + gap: theme.spacing(4), + borderRadius: theme.shape.borderRadius, + pl: theme.spacing(4), + "&::before": { + content: `""`, + position: "absolute", + top: 0, + left: "-7px", + height: "100%", + borderLeft: 1, + borderLeftColor: theme.palette.primary.lowContrast, + }, + "&:last-child::before": { + height: "50%", + }, + "&::after": { + content: `""`, + position: "absolute", + top: "45%", + left: "-8px", + height: "3px", + width: "3px", + borderRadius: "50%", + backgroundColor: theme.palette.primary.lowContrast, + }, + "&.selected-path::after": { + /* TODO what is this selector doing? */ + backgroundColor: theme.palette.primary.contrastTextTertiary, + transform: "scale(1.2)", + }, + }} + > + {child.icon} + {child.name} + + ); + })} + + + + ); + })} +