From 3b3b8f644ab16fbbc0d81affa3c67c3f6d2fc982 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Mon, 30 Oct 2023 11:35:16 +0545 Subject: [PATCH 1/2] feat (sideBar): signIn/signOut added to the sidebar --- src/frontend/src/utilities/CustomDrawer.jsx | 29 +++++++++++++++++++- src/frontend/src/utilities/PrimaryAppBar.tsx | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/utilities/CustomDrawer.jsx b/src/frontend/src/utilities/CustomDrawer.jsx index ed11a7279c..e13dcebc18 100644 --- a/src/frontend/src/utilities/CustomDrawer.jsx +++ b/src/frontend/src/utilities/CustomDrawer.jsx @@ -3,9 +3,13 @@ import SwipeableDrawer from '@mui/material/SwipeableDrawer'; import CoreModules from '../shared/CoreModules'; import AssetModules from '../shared/AssetModules'; import { NavLink } from 'react-router-dom'; +import { createLoginWindow } from '../utilfunctions/login'; +import { LoginActions } from '../store/slices/LoginSlice'; +import { ProjectActions } from '../store/slices/ProjectSlice'; -export default function CustomDrawer({ open, placement, size, type, onClose, onSignOut }) { +export default function CustomDrawer({ open, placement, size, type, onClose, onSignOut, setOpen }) { const defaultTheme = CoreModules.useAppSelector((state) => state.theme.hotTheme); + const dispatch = CoreModules.useAppDispatch(); const onMouseEnter = (event) => { const element = document.getElementById(`text${event.target.id}`); @@ -81,6 +85,12 @@ export default function CustomDrawer({ open, placement, size, type, onClose, onS }, ]; + const handleOnSignOut = () => { + setOpen(false); + dispatch(LoginActions.signOut(null)); + dispatch(ProjectActions.clearProjects([])); + }; + return (
@@ -164,6 +174,23 @@ export default function CustomDrawer({ open, placement, size, type, onClose, onS ), )} +
+ {token != null ? ( +
+ Sign Out +
+ ) : ( +
createLoginWindow('/')} + > + Sign In +
+ )} +
diff --git a/src/frontend/src/utilities/PrimaryAppBar.tsx b/src/frontend/src/utilities/PrimaryAppBar.tsx index 299a528a00..d40952fd78 100755 --- a/src/frontend/src/utilities/PrimaryAppBar.tsx +++ b/src/frontend/src/utilities/PrimaryAppBar.tsx @@ -66,6 +66,7 @@ export default function PrimaryAppBar() { size={windowSize} type={type} onSignOut={handleOnSignOut} + setOpen={setOpen} /> Date: Mon, 30 Oct 2023 11:50:42 +0545 Subject: [PATCH 2/2] fix (sideBar): manageOrganizations, exploreProjects, signIn, signOut made hidden for large screens --- src/frontend/src/utilities/CustomDrawer.jsx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/frontend/src/utilities/CustomDrawer.jsx b/src/frontend/src/utilities/CustomDrawer.jsx index e13dcebc18..b6f4368292 100644 --- a/src/frontend/src/utilities/CustomDrawer.jsx +++ b/src/frontend/src/utilities/CustomDrawer.jsx @@ -154,14 +154,11 @@ export default function CustomDrawer({ open, placement, size, type, onClose, onS ), )} -
+
{token != null ? (
Sign Out
) : (
createLoginWindow('/')} > Sign In