diff --git a/frontend/src/components/AdminPanel/AdminSideBar/index.tsx b/frontend/src/components/AdminPanel/AdminSideBar/index.tsx index ce944de..866e13f 100644 --- a/frontend/src/components/AdminPanel/AdminSideBar/index.tsx +++ b/frontend/src/components/AdminPanel/AdminSideBar/index.tsx @@ -53,16 +53,13 @@ export default function SideBar() { }; return ( - + (null); const open = Boolean(anchorEl); + const [isDrawer, setIsDrawer] = React.useState(false); + const open1 = Boolean(isDrawer); + const matchesMediumScreen = useMediaQuery(theme.breakpoints.up('md')); + + useEffect(() => { + if (matchesMediumScreen) { + setIsDrawer(true); + } + }, [matchesMediumScreen]); + + const DrawerList = () => { + return ; + }; + const openmenu = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; @@ -121,31 +140,53 @@ export default function Navbar() { }; const profile_container = useRef(null); - return ( {location.pathname.startsWith('/admin') && user?.role === 'admin' ? ( - - - Manage Buses - - + { + setIsDrawer(!isDrawer); + }} > - {new Date().toLocaleDateString('en-UK', { - weekday: 'long', - day: 'numeric', - month: 'long', - year: 'numeric', - })} - - + + + {isDrawer && DrawerList()} + + + + + + Manage Buses + + + {new Date().toLocaleDateString('en-UK', { + weekday: 'long', + day: 'numeric', + month: 'long', + year: 'numeric', + })} + + + ) : ( (set => ({ user: null, isloading: true, setIsAuth: isAuth => set({isAuth}), - setUser: user => set({user}), + setUser: user => set({user: {...user, role: 'admin'}}), setIsLoading: isloading => set({isloading}), }));