From a2d54ce7d77bd017f2a7685af7deaee1abbfd33e Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Mon, 19 Aug 2024 13:23:17 -0400 Subject: [PATCH 1/7] Added collapse/expand button --- Client/src/Components/Sidebar/index.css | 16 ++- Client/src/Components/Sidebar/index.jsx | 114 ++++++++++++++---- Client/src/Layouts/HomeLayout/index.css | 5 - .../CreateMaintenanceWindow/index.jsx | 2 +- Client/src/assets/icons/left-arrow-long.svg | 3 + Client/src/assets/icons/left-arrow.svg | 4 +- 6 files changed, 109 insertions(+), 35 deletions(-) create mode 100644 Client/src/assets/icons/left-arrow-long.svg diff --git a/Client/src/Components/Sidebar/index.css b/Client/src/Components/Sidebar/index.css index 36415438c..d41778624 100644 --- a/Client/src/Components/Sidebar/index.css +++ b/Client/src/Components/Sidebar/index.css @@ -52,7 +52,7 @@ aside > .MuiListItemButton-root::before { content: ""; position: absolute; - left: -8px; + left: -7px; top: 0; height: 100%; width: 100%; @@ -65,7 +65,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 +74,18 @@ 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; +} +aside .MuiList-root { + transition: padding 100ms ease; +} \ No newline at end of file diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx index 159b01503..74e868aa8 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/Client/src/Components/Sidebar/index.jsx @@ -36,6 +36,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 +84,7 @@ function Sidebar() { const dispatch = useDispatch(); const authState = useSelector((state) => state.auth); const [open, setOpen] = useState({ Dashboard: false, Account: false }); + const [collapsed, setCollapsed] = useState(false); /** * Handles logging out the user @@ -105,9 +108,42 @@ function Sidebar() { }, []); return ( - - - + + + {!collapsed && } + setCollapsed(!collapsed)} + > + {collapsed ? : } + {/* menu */} Menu } + sx={{ px: collapsed ? theme.gap.xs : theme.gap.ml }} > {menu.map((item) => item.path ? ( @@ -135,10 +176,23 @@ function Sidebar() { sx={{ gap: theme.gap.medium, borderRadius: `${theme.shape.borderRadius}px`, + justifyContent: collapsed ? "center" : "flex-start", }} > {item.icon} - {item.name} + {!collapsed && {item.name}} + + ) : collapsed ? ( + + {item.icon} + {!collapsed && {item.name}} ) : ( @@ -152,6 +206,7 @@ function Sidebar() { sx={{ gap: theme.gap.medium, borderRadius: `${theme.shape.borderRadius}px`, + justifyContent: collapsed ? "center" : "flex-start", }} > {item.icon} @@ -210,11 +265,16 @@ function Sidebar() { Other } + sx={{ px: collapsed ? theme.gap.xs : theme.gap.ml }} > {other.map((item) => ( {item.icon} - {item.name} + {!collapsed && {item.name}} ))} + - - - {authState.user?.firstName} {authState.user?.lastName} - - - {authState.user?.role} - - - - - - - + {!collapsed && ( + <> + + + {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/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 @@ - - + + From a28caa38cd78460feb13cdb1442dcb84b2abf6b2 Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Mon, 19 Aug 2024 14:01:26 -0400 Subject: [PATCH 2/7] Added nested button menu popup --- Client/src/Components/Sidebar/index.css | 32 +++++++++- Client/src/Components/Sidebar/index.jsx | 79 +++++++++++++++++++++---- 2 files changed, 99 insertions(+), 12 deletions(-) diff --git a/Client/src/Components/Sidebar/index.css b/Client/src/Components/Sidebar/index.css index d41778624..68e1988b0 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); } @@ -88,4 +89,33 @@ aside { } aside .MuiList-root { transition: padding 100ms ease; -} \ No newline at end of file +} + +.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 8px; + 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 .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 74e868aa8..dd7d07bd7 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, @@ -85,6 +87,16 @@ function Sidebar() { 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 @@ -183,17 +195,62 @@ function Sidebar() { {!collapsed && {item.name}} ) : collapsed ? ( - - {item.icon} - {!collapsed && {item.name}} - + + 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}`)} + sx={{ + gap: theme.gap.small, + borderRadius: `${theme.shape.borderRadius}px`, + pl: theme.gap.small, + }} + > + {child.icon} + {child.name} + + ); + })} + + ) : ( Date: Mon, 19 Aug 2024 14:30:44 -0400 Subject: [PATCH 3/7] Added logout popup --- Client/src/Components/Sidebar/index.css | 6 ++ Client/src/Components/Sidebar/index.jsx | 76 +++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/Client/src/Components/Sidebar/index.css b/Client/src/Components/Sidebar/index.css index 68e1988b0..2b2aef8b2 100644 --- a/Client/src/Components/Sidebar/index.css +++ b/Client/src/Components/Sidebar/index.css @@ -110,6 +110,12 @@ aside .MuiList-root { .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); diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx index dd7d07bd7..dd8ce8087 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/Client/src/Components/Sidebar/index.jsx @@ -197,7 +197,11 @@ function Sidebar() { ) : collapsed ? ( openPopup(event, item.name)} sx={{ position: "relative", @@ -237,7 +241,10 @@ function Sidebar() { : "" } key={child.path} - onClick={() => navigate(`/${child.path}`)} + onClick={() => { + navigate(`/${child.path}`); + closePopup(); + }} sx={{ gap: theme.gap.small, borderRadius: `${theme.shape.borderRadius}px`, @@ -371,9 +378,70 @@ function Sidebar() { gap={theme.gap.xs} borderRadius={`${theme.shape.borderRadius}px`} > - - {!collapsed && ( + {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} From 1ae85ad9ea329f722c423117f7290e7f75535358 Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Mon, 19 Aug 2024 14:37:25 -0400 Subject: [PATCH 4/7] Added abbreviated bluewave uptime logo --- Client/src/Components/Sidebar/index.jsx | 17 +++++++++++------ Client/src/assets/icons/bwu-abbreviated.svg | 4 ++++ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 Client/src/assets/icons/bwu-abbreviated.svg diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx index dd8ce8087..f6e319b76 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/Client/src/Components/Sidebar/index.jsx @@ -26,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"; @@ -125,17 +126,21 @@ function Sidebar() { gap={theme.gap.medium} sx={{ flex: collapsed ? 0 : 1 }} > - - {!collapsed && } + {collapsed ? ( + + ) : ( + + )} {collapsed ? : } - + {/* menu */} + + + From c20600d1021f724c01a2729e03f22d9712ffbafa Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Mon, 19 Aug 2024 14:50:24 -0400 Subject: [PATCH 5/7] Updated padding and transition --- Client/src/Components/Sidebar/index.css | 5 +---- Client/src/Components/Sidebar/index.jsx | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Client/src/Components/Sidebar/index.css b/Client/src/Components/Sidebar/index.css index 2b2aef8b2..59924b1a1 100644 --- a/Client/src/Components/Sidebar/index.css +++ b/Client/src/Components/Sidebar/index.css @@ -87,9 +87,6 @@ aside .MuiCollapse-wrapperInner .MuiList-root > .MuiListItemButton-root::after { aside { transition: flex 300ms ease-out; } -aside .MuiList-root { - transition: padding 100ms ease; -} .sidebar-popup .MuiPaper-root { box-shadow: var(--env-var-shadow-1); @@ -98,7 +95,7 @@ aside .MuiList-root { gap: 1px; } .sidebar-popup .MuiList-root { - padding: 6px 8px; + padding: 6px 6px; min-width: 100px; } .sidebar-popup li.MuiButtonBase-root { diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx index f6e319b76..cb1232b9c 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/Client/src/Components/Sidebar/index.jsx @@ -132,7 +132,7 @@ function Sidebar() { pl={collapsed ? 0 : theme.gap.lgplus} > {collapsed ? ( - + ) : ( )} From 1c31b13438cd795a1759a2ee066d9c7372b902ba Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Mon, 19 Aug 2024 15:00:11 -0400 Subject: [PATCH 6/7] Added tooltips to buttons in collapsed view --- Client/src/Components/Sidebar/index.jsx | 133 ++++++++++++++++-------- 1 file changed, 92 insertions(+), 41 deletions(-) diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx index cb1232b9c..e197f2dbf 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/Client/src/Components/Sidebar/index.jsx @@ -184,32 +184,29 @@ function Sidebar() { > {menu.map((item) => item.path ? ( - 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)} + key={item.path} + onClick={() => navigate(`/${item.path}`)} sx={{ - position: "relative", gap: theme.gap.medium, borderRadius: `${theme.shape.borderRadius}px`, justifyContent: collapsed ? "center" : "flex-start", @@ -218,6 +215,43 @@ function Sidebar() { {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}} + + {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`, - justifyContent: collapsed ? "center" : "flex-start", + - {item.icon} - {!collapsed && {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}} + + ))} From b27712a62933845510619f7ff469a788304d03bd Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Mon, 19 Aug 2024 15:04:04 -0400 Subject: [PATCH 7/7] Fixed key prop error --- Client/src/Components/Sidebar/index.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx index e197f2dbf..38baa33ec 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/Client/src/Components/Sidebar/index.jsx @@ -185,6 +185,7 @@ function Sidebar() { {menu.map((item) => item.path ? ( navigate(`/${item.path}`)} sx={{ gap: theme.gap.medium, @@ -381,6 +381,7 @@ function Sidebar() { > {other.map((item) => ( item.path === "support" ? window.open(