- Updated the icons;

- Extracted the Layout into its own component;
This commit is contained in:
Tiago Ribeiro
2023-06-15 09:12:13 +01:00
parent ec3157870e
commit 60217e9a66
5 changed files with 281 additions and 278 deletions

View File

@@ -0,0 +1,20 @@
import {User} from "@/interfaces/user";
import Navbar from "../Navbar";
import Sidebar from "../Sidebar";
interface Props {
user: User;
children: React.ReactNode;
}
export default function Layout({user, children}: Props) {
return (
<main className="w-full h-[100vh] flex flex-col bg-mti-gray-smoke">
<Navbar user={user} />
<div className="h-full w-full flex py-4 pb-8 gap-2">
<Sidebar path={window.location.pathname} />
<div className="w-5/6 h-full mr-8 bg-white shadow-md rounded-2xl p-12 flex flex-col gap-12">{children}</div>
</div>
</main>
);
}

View File

@@ -1,7 +1,7 @@
import clsx from "clsx";
import {IconType} from "react-icons";
import {MdSpaceDashboard} from "react-icons/md";
import {BsFileEarmarkText, BsClockHistory} from "react-icons/bs";
import {BsFileEarmarkText, BsClockHistory, BsPencil, BsGraphUp} from "react-icons/bs";
import {RiLogoutBoxFill} from "react-icons/ri";
import {SlPencil} from "react-icons/sl";
import {FaAward} from "react-icons/fa";
@@ -46,8 +46,8 @@ export default function Sidebar({path}: Props) {
<div className="flex flex-col gap-3">
<Nav Icon={MdSpaceDashboard} label="Dashboard" path={path} keyPath="/" />
<Nav Icon={BsFileEarmarkText} label="Exams" path={path} keyPath="/exam" />
<Nav Icon={SlPencil} label="Exercises" path={path} keyPath="/exercise" />
<Nav Icon={FaAward} label="Score" path={path} keyPath="/score" />
<Nav Icon={BsPencil} label="Exercises" path={path} keyPath="/exercise" />
<Nav Icon={BsGraphUp} label="Stats" path={path} keyPath="/stats" />
<Nav Icon={BsClockHistory} label="Record" path={path} keyPath="/record" />
</div>

View File

@@ -20,6 +20,7 @@ import {v4 as uuidv4} from "uuid";
import useUser from "@/hooks/useUser";
import useExamStore from "@/stores/examStore";
import Sidebar from "@/components/Sidebar";
import Layout from "@/components/High/Layout";
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
const user = req.session.user;
@@ -208,15 +209,7 @@ export default function Page() {
<link rel="icon" href="/favicon.ico" />
</Head>
<ToastContainer />
{user && (
<main className="w-full h-[100vh] flex flex-col bg-mti-gray-smoke">
<Navbar user={user} />
<div className="h-full w-full flex py-4 pb-8 gap-2">
<Sidebar path="/exam" />
<div className="w-5/6 h-full mr-8 bg-white shadow-md rounded-2xl p-12 flex flex-col gap-12">{renderScreen()}</div>
</div>
</main>
)}
{user && <Layout user={user}>{renderScreen()}</Layout>}
</>
);
}

View File

@@ -14,6 +14,7 @@ import {ToastContainer} from "react-toastify";
import {capitalize} from "lodash";
import {Module} from "@/interfaces";
import ProgressBar from "@/components/Low/ProgressBar";
import Layout from "@/components/High/Layout";
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
const user = req.session.user;
@@ -79,11 +80,7 @@ export default function Home() {
</Head>
<ToastContainer />
{user && (
<main className="w-full h-[100vh] flex flex-col bg-mti-gray-smoke">
<Navbar user={user} />
<div className="h-full w-full flex py-4 pb-8 gap-2">
<Sidebar path="/" />
<div className="w-5/6 h-full mr-8 bg-white shadow-md rounded-2xl p-12 flex flex-col gap-12">
<Layout user={user}>
<section className="w-full flex gap-8">
<img src={user.profilePicture} alt={user.name} className="aspect-square h-64 rounded-3xl drop-shadow-xl" />
<div className="flex flex-col gap-4 py-4 w-full">
@@ -134,11 +131,11 @@ export default function Home() {
<section className="flex flex-col gap-3">
<span className="font-bold text-lg">Bio</span>
<span className="text-mti-gray-taupe">
Patricia Smith is a dedicated and enthusiastic student. Her passion for knowledge drives her to constantly seek
new academic challenges. She is recognized for her exemplary work ethic, active participation in the classroom,
and commitment to helping her peers. Her insatiable curiosity has led her to explore a wide range of areas of
study, making her a versatile and adaptable learner. Patricia is a true academic leader, inspiring other students
to pursue their own educational goals.
Patricia Smith is a dedicated and enthusiastic student. Her passion for knowledge drives her to constantly seek new
academic challenges. She is recognized for her exemplary work ethic, active participation in the classroom, and commitment
to helping her peers. Her insatiable curiosity has led her to explore a wide range of areas of study, making her a
versatile and adaptable learner. Patricia is a true academic leader, inspiring other students to pursue their own
educational goals.
</span>
</section>
<section className="flex flex-col gap-3">
@@ -230,9 +227,7 @@ export default function Home() {
</div>
</div>
</section>
</div>
</div>
</main>
</Layout>
)}
</>
);

View File

@@ -10,6 +10,7 @@ import Sidebar from "@/components/Sidebar";
import dynamic from "next/dynamic";
import {BsCheckCircleFill, BsMicFill, BsPauseCircle, BsPauseFill, BsPlayCircle, BsPlayFill, BsTrashFill} from "react-icons/bs";
import {useEffect, useState} from "react";
import Layout from "@/components/High/Layout";
const Waveform = dynamic(() => import("../components/Waveform"), {ssr: false});
const ReactMediaRecorder = dynamic(() => import("react-media-recorder").then((mod) => mod.ReactMediaRecorder), {
@@ -67,11 +68,7 @@ export default function Page() {
</Head>
<ToastContainer />
{user && (
<main className="w-full h-[100vh] flex flex-col bg-mti-gray-smoke">
<Navbar user={user} />
<div className="h-full w-full flex py-4 pb-8 gap-2">
<Sidebar path="/exam" />
<div className="w-5/6 h-full mr-8 bg-white shadow-md rounded-2xl p-12 flex flex-col gap-12">
<Layout user={user}>
<ReactMediaRecorder
audio
onStop={(blob) => setMediaBlob(blob)}
@@ -186,9 +183,7 @@ export default function Page() {
</div>
)}
/>
</div>
</div>
</main>
</Layout>
)}
</>
);