diff --git a/src/dashboards/Student.tsx b/src/dashboards/Student.tsx index 3a8609d9..3d128d04 100644 --- a/src/dashboards/Student.tsx +++ b/src/dashboards/Student.tsx @@ -27,6 +27,7 @@ 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"; interface Props { user: User; @@ -69,6 +70,9 @@ export default function StudentDashboard({user, users, linkedCorporate}: Props) }); }; + const studentAssignments = assignments + .filter(activeAssignmentFilter); + return ( <> {linkedCorporate && ( @@ -119,10 +123,9 @@ export default function StudentDashboard({user, users, linkedCorporate}: Props) - {assignments.filter((a) => moment(a.endDate).isSameOrAfter(moment())).length === 0 && + {studentAssignments.length === 0 && "Assignments will appear here. It seems that for now there are no assignments for you."} - {assignments - .filter((a) => moment(a.endDate).isSameOrAfter(moment())) + {studentAssignments .sort((a, b) => moment(a.startDate).diff(b.startDate)) .map((assignment) => (