diff --git a/src/components/MobileMenu.tsx b/src/components/MobileMenu.tsx index cad02960..2b8b95fe 100644 --- a/src/components/MobileMenu.tsx +++ b/src/components/MobileMenu.tsx @@ -1,201 +1,160 @@ -import { User } from "@/interfaces/user"; -import { Dialog, Transition } from "@headlessui/react"; +import {User} from "@/interfaces/user"; +import {Dialog, Transition} from "@headlessui/react"; import axios from "axios"; import clsx from "clsx"; import Image from "next/image"; import Link from "next/link"; -import { useRouter } from "next/router"; -import { Fragment } from "react"; -import { BsXLg } from "react-icons/bs"; +import {useRouter} from "next/router"; +import {Fragment} from "react"; +import {BsXLg} from "react-icons/bs"; interface Props { - isOpen: boolean; - onClose: () => void; - path: string; - user: User; + isOpen: boolean; + onClose: () => void; + path: string; + user: User; + disableNavigation?: boolean; } -export default function MobileMenu({ isOpen, onClose, path, user }: Props) { - const router = useRouter(); +export default function MobileMenu({isOpen, onClose, path, user, disableNavigation}: Props) { + const router = useRouter(); - const logout = async () => { - axios.post("/api/logout").finally(() => { - setTimeout(() => router.reload(), 500); - }); - }; + const logout = async () => { + axios.post("/api/logout").finally(() => { + setTimeout(() => router.reload(), 500); + }); + }; - return ( - - - -
- + return ( + + + +
+ -
-
- - - - - EnCoach logo - -
- -
-
-
- - Dashboard - - {(user.type === "student" || - user.type === "teacher" || - user.type === "developer") && ( - <> - - Exams - - - Exercises - - - )} - - Stats - - - Record - - {["admin", "developer", "agent", "corporate"].includes( - user.type, - ) && ( - - Payment Record - - )} - {["admin", "developer", "corporate", "teacher"].includes( - user.type, - ) && ( - - Settings - - )} - {["admin", "developer", "agent"].includes(user.type) && ( - - Tickets - - )} - - Profile - +
+
+ + + + + EnCoach logo + +
+ +
+
+
+ + Dashboard + + {(user.type === "student" || user.type === "teacher" || user.type === "developer") && ( + <> + + Exams + + + Exercises + + + )} + + Stats + + + Record + + {["admin", "developer", "agent", "corporate"].includes(user.type) && ( + + Payment Record + + )} + {["admin", "developer", "corporate", "teacher"].includes(user.type) && ( + + Settings + + )} + {["admin", "developer", "agent"].includes(user.type) && ( + + Tickets + + )} + + Profile + - - Logout - -
-
-
-
-
-
-
- ); + + Logout + +
+ +
+ + +
+
+ ); } diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 5445619c..103d772f 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -62,7 +62,9 @@ export default function Navbar({user, path, navDisabled = false, focusMode = fal setIsTicketOpen(false)} /> - {user && setIsMenuOpen(false)} user={user} />} + {user && ( + setIsMenuOpen(false)} user={user} /> + )}
EnCoach's Logo