From d15b2c0f133abc6be8abb0b8e2bfe0f8277d0ba2 Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Mon, 19 Aug 2024 14:30:44 -0400 Subject: [PATCH] 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}