From 49aac93618b42876aa03293a1b108222d889018f Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Wed, 4 Sep 2024 14:50:47 +0100 Subject: [PATCH] Updated the look of the assignments --- src/components/ModuleBadge.tsx | 10 ++++++++-- src/dashboards/Student.tsx | 36 +++++++++------------------------- 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/components/ModuleBadge.tsx b/src/components/ModuleBadge.tsx index 0a791bd6..a3dc62ee 100644 --- a/src/components/ModuleBadge.tsx +++ b/src/components/ModuleBadge.tsx @@ -3,15 +3,21 @@ import {getGradingLabel, getLevelLabel} from "@/utils/score"; import clsx from "clsx"; import {BsBook, BsClipboard, BsHeadphones, BsMegaphone, BsPen} from "react-icons/bs"; -const ModuleBadge: React.FC<{module: string; level?: number; gradingSystem?: Step[]}> = ({module, level, gradingSystem}) => ( +const ModuleBadge: React.FC<{module: string; level?: number; gradingSystem?: Step[]; className?: string}> = ({ + module, + level, + gradingSystem, + className, +}) => (
{module === "reading" && } {module === "listening" && } diff --git a/src/dashboards/Student.tsx b/src/dashboards/Student.tsx index 354121dc..3789748c 100644 --- a/src/dashboards/Student.tsx +++ b/src/dashboards/Student.tsx @@ -27,7 +27,8 @@ import {useRouter} from "next/router"; import {useEffect, useState} from "react"; import {BsArrowRepeat, BsBook, BsClipboard, BsFileEarmarkText, BsHeadphones, BsMegaphone, BsPen, BsPencil, BsStar} from "react-icons/bs"; import {toast} from "react-toastify"; -import { activeAssignmentFilter } from "@/utils/assignments"; +import {activeAssignmentFilter} from "@/utils/assignments"; +import ModuleBadge from "@/components/ModuleBadge"; interface Props { user: User; @@ -70,8 +71,7 @@ export default function StudentDashboard({user, users, linkedCorporate}: Props) }); }; - const studentAssignments = assignments - .filter(activeAssignmentFilter); + const studentAssignments = assignments.filter(activeAssignmentFilter); return ( <> @@ -123,49 +123,32 @@ export default function StudentDashboard({user, users, linkedCorporate}: Props)
- {studentAssignments.length === 0 && - "Assignments will appear here. It seems that for now there are no assignments for you."} + {studentAssignments.length === 0 && "Assignments will appear here. It seems that for now there are no assignments for you."} {studentAssignments .sort((a, b) => moment(a.startDate).diff(b.startDate)) .map((assignment) => (
r.user).includes(user.id) && "border-mti-green-light", )} key={assignment.id}>

{assignment.name}

- + {moment(assignment.startDate).format("DD/MM/YY, HH:mm")} - {moment(assignment.endDate).format("DD/MM/YY, HH:mm")}
-
+
{assignment.exams .filter((e) => e.assignee === user.id) .map((e) => e.module) .sort(sortByModuleName) .map((module) => ( -
- {module === "reading" && } - {module === "listening" && } - {module === "writing" && } - {module === "speaking" && } - {module === "level" && } -
+ ))}
{!assignment.results.map((r) => r.user).includes(user.id) && ( @@ -173,12 +156,11 @@ export default function StudentDashboard({user, users, linkedCorporate}: Props)
-