Started the redesign of the dashboard

This commit is contained in:
Tiago Ribeiro
2023-05-26 19:46:50 +01:00
parent 2b34bf8f0b
commit 9ed3672cb6
8 changed files with 99 additions and 100 deletions

View File

@@ -208,10 +208,7 @@ export default function Page() {
</Head>
<ToastContainer />
{user && (
<main className="w-full h-full min-h-[100vh] flex flex-col items-center bg-neutral-100 text-black pb-4 gap-4">
<Navbar userType={user.type} profilePicture={user.profilePicture} timer={exam ? timer : undefined} />
{renderScreen()}
</main>
<main className="w-full h-full min-h-[100vh] flex flex-col items-center bg-neutral-100 text-black pb-4 gap-4">{renderScreen()}</main>
)}
</>
);

View File

@@ -152,7 +152,6 @@ export default function History({user}: {user: User}) {
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="w-full h-full min-h-[100vh] flex flex-col bg-neutral-100 text-black">
<Navbar userType={user.type} profilePicture={user.profilePicture} />
<div className="w-fit self-center">
{!isUsersLoading && user.type !== "student" && (
<Dropdown value={selectedUser} options={users} optionLabel="name" onChange={(e) => setSelectedUser(e.target.value)} />

View File

@@ -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>
)}