Skip to content

Commit ecb2d1f

Browse files
committed
feat: add evaluator controls
1 parent de2314d commit ecb2d1f

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

app/evaluatorcontrols/page.tsx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
"use client";
2+
3+
import Button from "@/components/ui/Button";
4+
import DangerButton from "@/components/ui/DangerButton";
5+
import { useAuth } from "@/context/AuthContext";
6+
import Link from "next/link";
7+
import { useRouter } from "next/navigation";
8+
import React, { useEffect } from "react";
9+
10+
const AdminControls = () => {
11+
const { user, getUser } = useAuth();
12+
13+
useEffect(() => {
14+
if (!user) {
15+
getUser();
16+
}
17+
// eslint-disable-next-line react-hooks/exhaustive-deps
18+
}, []);
19+
20+
const router = useRouter();
21+
22+
if (!user) {
23+
return (
24+
<div className="flex items-center justify-center h-screen bg-[#09090b]">
25+
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-gray-300" />
26+
</div>
27+
);
28+
}
29+
30+
if (user.role === "USER") {
31+
return (
32+
<div className="flex items-center justify-center h-screen bg-[#09090b] text-red-400">
33+
You do not have the permissions to view this page
34+
</div>
35+
);
36+
}
37+
38+
return (
39+
<div className="bg-[#09090b] w-full h-screen flex flex-col text-white">
40+
<header className="w-full bg-[#121212] flex items-center justify-between px-6 py-3 border-b border-gray-700">
41+
<h1 className="text-lg font-bold">Admin Controls</h1>
42+
<DangerButton buttonText="Go Back" onClick={() => router.push("/")} />
43+
</header>
44+
<div className="flex-grow flex items-center justify-center">
45+
<div className="flex flex-col gap-4 items-center">
46+
<Link href="/allteams">
47+
<Button
48+
buttonText="View All Teams"
49+
onClick={() => {}}
50+
customStyle="w-[400px]"
51+
/>
52+
</Link>
53+
<Link href="/allprojects">
54+
<Button
55+
buttonText="View All Projects"
56+
onClick={() => {}}
57+
customStyle="w-[400px]"
58+
/>
59+
</Link>
60+
</div>
61+
</div>
62+
</div>
63+
);
64+
};
65+
66+
export default AdminControls;

components/ui/HeaderComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const HeaderComponent = () => {
8181

8282
{user && user.role === "EVALUATOR" && (
8383
<Link href="/evaluatorcontrols">
84-
<Button buttonText="Go to Admin Controls" onClick={() => {}} />
84+
<Button buttonText="Go to Evaluator Controls" onClick={() => {}} />
8585
</Link>
8686
)}
8787

0 commit comments

Comments
 (0)