diff --git a/package.json b/package.json
index ac6ba615..a31d3cc6 100644
--- a/package.json
+++ b/package.json
@@ -34,6 +34,7 @@
"react-chartjs-2": "^5.2.0",
"react-dom": "18.2.0",
"react-firebase-hooks": "^5.1.1",
+ "react-icons": "^4.8.0",
"react-lineto": "^3.3.0",
"react-media-recorder": "^1.6.6",
"react-player": "^2.12.0",
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx
index 263954e0..c4aae9cc 100644
--- a/src/components/Navbar.tsx
+++ b/src/components/Navbar.tsx
@@ -1,77 +1,22 @@
-import {Type} from "@/interfaces/user";
-import axios from "axios";
-import Link from "next/link";
-import {useRouter} from "next/router";
-import {Button} from "primereact/button";
-import {Menubar} from "primereact/menubar";
-import {MenuItem} from "primereact/menuitem";
+import {User} from "@/interfaces/user";
+import {Avatar} from "primereact/avatar";
interface Props {
- profilePicture: string;
- userType: Type;
- timer?: number;
- showExamEnd?: boolean;
+ user: User;
}
/* eslint-disable @next/next/no-img-element */
-export default function Navbar({profilePicture, userType, timer, showExamEnd = false}: Props) {
- const router = useRouter();
-
- const logout = async () => {
- axios.post("/api/logout").finally(() => {
- router.push("/login");
- });
- };
-
- const items: MenuItem[] = [
- {
- label: "Home",
- icon: "pi pi-fw pi-home",
- url: "/",
- },
- {
- label: "Account",
- icon: "pi pi-fw pi-user",
- url: "/profile",
- },
- {
- label: "Exam",
- icon: "pi pi-fw pi-plus-circle",
- url: "/exam",
- },
- {
- label: "Users",
- icon: "pi pi-fw pi-users",
- items: [
- ...(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"},
- ],
- },
- {
- label: "Logout",
- icon: "pi pi-fw pi-power-off",
- command: logout,
- },
- ];
-
- const endTimer = timer && (
-
- {Math.floor(timer / 60) < 10 ? "0" : ""}
- {Math.floor(timer / 60)}:{timer % 60 < 10 ? "0" : ""}
- {timer % 60}
-
- );
-
- const endNewExam = (
-
-
-
- );
-
+export default function Navbar({user}: Props) {
return (
-
-
-
+
);
}
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
new file mode 100644
index 00000000..f5fa705a
--- /dev/null
+++ b/src/components/Sidebar.tsx
@@ -0,0 +1,66 @@
+import clsx from "clsx";
+import {IconType} from "react-icons";
+import {MdSpaceDashboard} from "react-icons/md";
+import {BsFileEarmarkText, BsClockHistory} from "react-icons/bs";
+import {RiLogoutBoxFill} from "react-icons/ri";
+import {SlPencil} from "react-icons/sl";
+import {FaAward} from "react-icons/fa";
+import Link from "next/link";
+import {useRouter} from "next/router";
+import axios from "axios";
+
+interface Props {
+ path: string;
+}
+
+interface NavProps {
+ Icon: IconType;
+ label: string;
+ path: string;
+ keyPath: string;
+}
+
+const Nav = ({Icon, label, path, keyPath}: NavProps) => (
+
+
+ {label}
+
+);
+
+export default function Sidebar({path}: Props) {
+ const router = useRouter();
+
+ const logout = async () => {
+ axios.post("/api/logout").finally(() => {
+ router.push("/login");
+ });
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ Log Out
+
+
+ );
+}
diff --git a/src/pages/exam/index.tsx b/src/pages/exam/index.tsx
index b66bb1c4..585457ea 100644
--- a/src/pages/exam/index.tsx
+++ b/src/pages/exam/index.tsx
@@ -208,10 +208,7 @@ export default function Page() {
{user && (
-
-
- {renderScreen()}
-
+ {renderScreen()}
)}
>
);
diff --git a/src/pages/history.tsx b/src/pages/history.tsx
index d8ae5a92..244606cb 100644
--- a/src/pages/history.tsx
+++ b/src/pages/history.tsx
@@ -152,7 +152,6 @@ export default function History({user}: {user: User}) {
-
{!isUsersLoading && user.type !== "student" && (
setSelectedUser(e.target.value)} />
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 639cb0a3..fe0cf8fa 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -11,6 +11,7 @@ import useStats from "@/hooks/useStats";
import {averageScore, formatModuleTotalStats, totalExams} from "@/utils/stats";
import {Divider} from "primereact/divider";
import useUser from "@/hooks/useUser";
+import Sidebar from "@/components/Sidebar";
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
const user = req.session.user;
@@ -53,32 +54,11 @@ export default function Home() {
{user && (
-
-
-
-
-
- {windowWidth <= 960 && }
-
-
Statistics
- {!isLoading && stats && (
-
-
- Exams: {totalExams(stats)}
- Exercises: {stats.length}
- Average Score: {averageScore(stats)}%
-
-
- )}
-
-
- {!isLoading && stats && (
-
- )}
+
+
+
)}
diff --git a/tailwind.config.js b/tailwind.config.js
index d3b2fedd..e3150a4b 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -4,6 +4,12 @@ module.exports = {
theme: {
extend: {
colors: {
+ mti: {
+ orange: "#FF6000",
+ green: "#51C21A",
+ blue: "#007FF8",
+ gray: "#F9F9F9",
+ },
ielts: {
reading: {DEFAULT: "#FF6384", transparent: "rgba(255, 99, 132, 0.5)"},
listening: {DEFAULT: "#36A2EB", transparent: "rgba(54, 162, 235, 0.5)"},
diff --git a/yarn.lock b/yarn.lock
index 9317b77d..271cbb1d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3120,6 +3120,11 @@ react-firebase-hooks@^5.1.1:
resolved "https://registry.npmjs.org/react-firebase-hooks/-/react-firebase-hooks-5.1.1.tgz"
integrity sha512-y2UpWs82xs+39q5Rc/wq316ca52QsC0n8m801V+yM4IC4hbfOL4yQPVSh7w+ydstdvjN9F+lvs1WrO2VYxpmdA==
+react-icons@^4.8.0:
+ version "4.8.0"
+ resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.8.0.tgz#621e900caa23b912f737e41be57f27f6b2bff445"
+ integrity sha512-N6+kOLcihDiAnj5Czu637waJqSnwlMNROzVZMhfX68V/9bu9qHaMIJC4UdozWoOk57gahFCNHwVvWzm0MTzRjg==
+
react-is@^16.13.1, react-is@^16.8.1:
version "16.13.1"
resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"