diff --git a/Client/src/Components/Sidebar/index.css b/Client/src/Components/Sidebar/index.css index 36415438c..59924b1a1 100644 --- a/Client/src/Components/Sidebar/index.css +++ b/Client/src/Components/Sidebar/index.css @@ -1,4 +1,5 @@ aside .selected-path, +.sidebar-popup .selected-path, aside .MuiListItemButton-root:hover { background-color: var(--env-var-color-13); } @@ -52,7 +53,7 @@ aside > .MuiListItemButton-root::before { content: ""; position: absolute; - left: -8px; + left: -7px; top: 0; height: 100%; width: 100%; @@ -65,7 +66,8 @@ aside > .MuiListItemButton-root:last-child::before { height: 50%; } -aside .MuiCollapse-wrapperInner .MuiList-root svg { +aside .MuiCollapse-wrapperInner .MuiList-root svg, +aside .MuiList-root .MuiListItemText-root + svg { width: 18px; height: 18px; } @@ -73,11 +75,50 @@ aside .MuiCollapse-wrapperInner .MuiList-root svg { aside .MuiCollapse-wrapperInner .MuiList-root > .MuiListItemButton-root::after { content: ""; position: absolute; - left: -8px; + left: -7px; top: 50%; height: 1px; - width: 7px; + width: 6px; border-radius: 50%; background-color: var(--env-var-color-5); opacity: 0.3; } + +aside { + transition: flex 300ms ease-out; +} + +.sidebar-popup .MuiPaper-root { + box-shadow: var(--env-var-shadow-1); + border: solid 1px var(--env-var-color-6); + border-radius: var(--env-var-radius-1); + gap: 1px; +} +.sidebar-popup .MuiList-root { + padding: 6px 6px; + min-width: 100px; +} +.sidebar-popup li.MuiButtonBase-root { + font-size: var(--env-var-font-size-medium); + color: var(--env-var-color-5); + padding: 5px 8px; + border-radius: var(--env-var-radius-1); +} +.sidebar-popup li.MuiButtonBase-root:hover{ + background-color: var(--env-var-color-13); +} +.sidebar-popup li.MuiButtonBase-root:has(.MuiBox-root):hover{ + background-color: white; +} +.sidebar-popup li.MuiButtonBase-root:has(.MuiBox-root){ + padding-bottom: 0; +} +.sidebar-popup .MuiModal-root p.MuiTypography-root { + font-size: var(--env-var-font-size-medium); + color: var(--env-var-color-2); +} +.sidebar-popup svg{ + width: 16px; + height: 16px; + opacity: 0.9; +} diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx index 159b01503..38baa33ec 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/Client/src/Components/Sidebar/index.jsx @@ -9,6 +9,8 @@ import { ListItemIcon, ListItemText, ListSubheader, + Menu, + MenuItem, Stack, Tooltip, Typography, @@ -24,6 +26,7 @@ import UserSvg from "../../assets/icons/user.svg?react"; import TeamSvg from "../../assets/icons/user-two.svg?react"; import LogoutSvg from "../../assets/icons/logout.svg?react"; import BWULogo from "../../assets/Images/bwl-logo.svg?react"; +import BWULogoAbbreviated from "../../assets/icons/bwu-abbreviated.svg?react"; import Support from "../../assets/icons/support.svg?react"; import Dashboard from "../../assets/icons/dashboard.svg?react"; import Account from "../../assets/icons/user-edit.svg?react"; @@ -36,6 +39,8 @@ import PageSpeed from "../../assets/icons/page-speed.svg?react"; import Settings from "../../assets/icons/settings.svg?react"; import ArrowDown from "../../assets/icons/down-arrow.svg?react"; import ArrowUp from "../../assets/icons/up-arrow.svg?react"; +import ArrowRight from "../../assets/icons/right-arrow.svg?react"; +import ArrowLeft from "../../assets/icons/left-arrow.svg?react"; import "./index.css"; @@ -82,6 +87,17 @@ function Sidebar() { const dispatch = useDispatch(); const authState = useSelector((state) => state.auth); const [open, setOpen] = useState({ Dashboard: false, Account: false }); + const [collapsed, setCollapsed] = useState(false); + const [anchorEl, setAnchorEl] = useState(null); + const [popup, setPopup] = useState(); + + const openPopup = (event, id) => { + setAnchorEl(event.currentTarget); + setPopup(id); + }; + const closePopup = () => { + setAnchorEl(null); + }; /** * Handles logging out the user @@ -105,10 +121,47 @@ function Sidebar() { }, []); return ( - - - - + + + {collapsed ? ( + + ) : ( + + )} + setCollapsed(!collapsed)} + > + {collapsed ? : } + + {/* menu */} Menu } + sx={{ px: collapsed ? theme.gap.xs : theme.gap.ml }} > {menu.map((item) => item.path ? ( - navigate(`/${item.path}`)} - sx={{ - gap: theme.gap.medium, - borderRadius: `${theme.shape.borderRadius}px`, + placement="right" + title={collapsed ? item.name : ""} + slotProps={{ + popper: { + modifiers: [ + { + name: "offset", + options: { + offset: [0, -16], + }, + }, + ], + }, }} > - {item.icon} - {item.name} - + navigate(`/${item.path}`)} + sx={{ + gap: theme.gap.medium, + borderRadius: `${theme.shape.borderRadius}px`, + justifyContent: collapsed ? "center" : "flex-start", + }} + > + {item.icon} + {!collapsed && {item.name}} + + + ) : collapsed ? ( + + + openPopup(event, item.name)} + sx={{ + position: "relative", + gap: theme.gap.medium, + borderRadius: `${theme.shape.borderRadius}px`, + justifyContent: collapsed ? "center" : "flex-start", + }} + > + {item.icon} + {!collapsed && {item.name}} + + + + {item.nested.map((child) => { + if ( + child.name === "Team" && + authState.user?.role && + !authState.user.role.includes("admin") + ) { + return null; + } + + return ( + { + navigate(`/${child.path}`); + closePopup(); + }} + sx={{ + gap: theme.gap.small, + borderRadius: `${theme.shape.borderRadius}px`, + pl: theme.gap.small, + }} + > + {child.icon} + {child.name} + + ); + })} + + ) : ( {item.icon} @@ -210,63 +368,154 @@ function Sidebar() { Other } + sx={{ px: collapsed ? theme.gap.xs : theme.gap.ml }} > {other.map((item) => ( - - item.path === "support" - ? window.open( - "https://github.com/bluewave-labs/bluewave-uptime", - "_blank", - "noreferrer" - ) - : navigate(`/${item.path}`) - } - sx={{ - gap: theme.gap.medium, - borderRadius: `${theme.shape.borderRadius}px`, + placement="right" + title={collapsed ? item.name : ""} + slotProps={{ + popper: { + modifiers: [ + { + name: "offset", + options: { + offset: [0, -16], + }, + }, + ], + }, }} > - {item.icon} - {item.name} - + + item.path === "support" + ? window.open( + "https://github.com/bluewave-labs/bluewave-uptime", + "_blank", + "noreferrer" + ) + : navigate(`/${item.path}`) + } + sx={{ + gap: theme.gap.medium, + borderRadius: `${theme.shape.borderRadius}px`, + justifyContent: collapsed ? "center" : "flex-start", + }} + > + {item.icon} + {!collapsed && {item.name}} + + ))} + - - - - {authState.user?.firstName} {authState.user?.lastName} - - - {authState.user?.role} - - - - - - - + {collapsed ? ( + <> + + openPopup(event, "logout")} + sx={{ p: 0, "&:focus": { outline: "none" } }} + > + + + + + + + + {authState.user?.firstName} {authState.user?.lastName} + + + {authState.user?.role} + + + + + + + Log out + + + + ) : ( + <> + + + + {authState.user?.firstName} {authState.user?.lastName} + + + {authState.user?.role} + + + + + + + + + )} ); diff --git a/Client/src/Layouts/HomeLayout/index.css b/Client/src/Layouts/HomeLayout/index.css index f143b3fd9..dcdcf0535 100644 --- a/Client/src/Layouts/HomeLayout/index.css +++ b/Client/src/Layouts/HomeLayout/index.css @@ -19,7 +19,6 @@ height: calc(100vh - var(--env-var-spacing-2) * 2); max-width: var(--env-var-side-bar-width); - flex: 1; border: 1px solid var(--color-border-0); border-radius: var(--env-var-radius-1); @@ -27,10 +26,6 @@ padding: var(--env-var-spacing-1) 0; } -.home-layout aside > *:not(:first-child) { - padding-left: var(--env-var-spacing-1-plus); - padding-right: var(--env-var-spacing-1-plus); -} .home-layout > div { min-height: calc(100vh - var(--env-var-spacing-2) * 2); diff --git a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx index 187d9c63d..8fff6e4a1 100644 --- a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx +++ b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx @@ -2,7 +2,7 @@ import { Box, Stack, Typography } from "@mui/material"; import "./index.css"; import React, { useState } from "react"; import Button from "../../../Components/Button"; -import Back from "../../../assets/icons/left-arrow.svg?react"; +import Back from "../../../assets/icons/left-arrow-long.svg?react"; import Select from "../../../Components/Inputs/Select"; import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"; import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; diff --git a/Client/src/assets/icons/bwu-abbreviated.svg b/Client/src/assets/icons/bwu-abbreviated.svg new file mode 100644 index 000000000..a5e00f484 --- /dev/null +++ b/Client/src/assets/icons/bwu-abbreviated.svg @@ -0,0 +1,4 @@ + + + + diff --git a/Client/src/assets/icons/left-arrow-long.svg b/Client/src/assets/icons/left-arrow-long.svg new file mode 100644 index 000000000..db9b827ed --- /dev/null +++ b/Client/src/assets/icons/left-arrow-long.svg @@ -0,0 +1,3 @@ + + + diff --git a/Client/src/assets/icons/left-arrow.svg b/Client/src/assets/icons/left-arrow.svg index db9b827ed..8b38c408a 100644 --- a/Client/src/assets/icons/left-arrow.svg +++ b/Client/src/assets/icons/left-arrow.svg @@ -1,3 +1,3 @@ - - + +