Started the redesign of the dashboard
This commit is contained in:
@@ -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() {
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
{user && (
|
||||
<main className="w-full h-full min-h-[100vh] flex flex-col items-center bg-neutral-100 text-black">
|
||||
<Navbar userType={user.type} profilePicture={user.profilePicture} showExamEnd={showEndExam} />
|
||||
<div className="w-full h-full p-4 relative flex flex-col gap-8">
|
||||
<section className="h-full w-full flex lg:gap-8 flex-col lg:flex-row justify-center md:justify-start md:items-start">
|
||||
<section className="w-full h-full flex items-center">
|
||||
<ProfileCard user={user} className="text-black self-start" />
|
||||
</section>
|
||||
{windowWidth <= 960 && <Divider />}
|
||||
<div className="flex flex-col w-full gap-4">
|
||||
<span className="font-bold text-2xl">Statistics</span>
|
||||
{!isLoading && stats && (
|
||||
<div className="text-neutral-600 flex flex-wrap gap-2 md:gap-4 w-full justify-between md:justify-start">
|
||||
<div className="bg-white p-4 rounded-xl drop-shadow-xl flex flex-col gap-2 md:gap-4 w-full">
|
||||
<span className="font-bold text-xl">Exams: {totalExams(stats)}</span>
|
||||
<span className="font-bold text-xl">Exercises: {stats.length}</span>
|
||||
<span className="font-bold text-xl">Average Score: {averageScore(stats)}%</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
{!isLoading && stats && (
|
||||
<section className="w-full lg:w-1/3 h-full flex items-center justify-center">
|
||||
<SingleDatasetChart type="polarArea" data={formatModuleTotalStats(stats)} title="Exams per Module" />
|
||||
</section>
|
||||
)}
|
||||
<main className="w-full h-full min-h-[100vh] flex flex-col bg-mti-gray text-black">
|
||||
<Navbar user={user} />
|
||||
<div className="h-full w-full flex py-4 gap-2">
|
||||
<Sidebar path="/" />
|
||||
<div className="w-5/6 mr-8 bg-white shadow-md rounded-2xl"></div>
|
||||
</div>
|
||||
</main>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user