diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 6b100da3..263954e0 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,3 +1,4 @@ +import {Type} from "@/interfaces/user"; import axios from "axios"; import Link from "next/link"; import {useRouter} from "next/router"; @@ -7,12 +8,13 @@ import {MenuItem} from "primereact/menuitem"; interface Props { profilePicture: string; + userType: Type; timer?: number; showExamEnd?: boolean; } /* eslint-disable @next/next/no-img-element */ -export default function Navbar({profilePicture, timer, showExamEnd = false}: Props) { +export default function Navbar({profilePicture, userType, timer, showExamEnd = false}: Props) { const router = useRouter(); const logout = async () => { @@ -41,7 +43,7 @@ export default function Navbar({profilePicture, timer, showExamEnd = false}: Pro label: "Users", icon: "pi pi-fw pi-users", items: [ - {label: "List", icon: "pi pi-fw pi-users", url: "/users"}, + ...(userType === "student" ? [] : [{label: "List", icon: "pi pi-fw pi-users", url: "/users"}]), {label: "Stats", icon: "pi pi-fw pi-chart-pie", url: "/stats"}, {label: "History", icon: "pi pi-fw pi-history", url: "/history"}, ], diff --git a/src/pages/exam/index.tsx b/src/pages/exam/index.tsx index 855d233b..1e171e4d 100644 --- a/src/pages/exam/index.tsx +++ b/src/pages/exam/index.tsx @@ -207,7 +207,7 @@ export default function Page() { {user && ( - + {renderScreen()} )} diff --git a/src/pages/history.tsx b/src/pages/history.tsx index 231da8a5..c4048d23 100644 --- a/src/pages/history.tsx +++ b/src/pages/history.tsx @@ -94,9 +94,9 @@ export default function History({user}: {user: User}) { - + - {!isUsersLoading && ( + {!isUsersLoading && user.type !== "student" && ( setSelectedUser(e.target.value)} /> )} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 10a05dad..639cb0a3 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -54,7 +54,7 @@ export default function Home() { {user && ( - + diff --git a/src/pages/profile.tsx b/src/pages/profile.tsx index d652f6a1..2c9ff5da 100644 --- a/src/pages/profile.tsx +++ b/src/pages/profile.tsx @@ -37,7 +37,7 @@ export default function Profile({user}: {user: User}) { - + diff --git a/src/pages/stats.tsx b/src/pages/stats.tsx index 5b819290..4b0447d6 100644 --- a/src/pages/stats.tsx +++ b/src/pages/stats.tsx @@ -56,9 +56,9 @@ export default function Stats({user}: {user: User}) { - + - {!isLoading && ( + {!isLoading && user.type !== "student" && ( - +