From 93c06e52b510ce8c086e5021bc3a24b0cf260db9 Mon Sep 17 00:00:00 2001 From: ALBERICLOOS Date: Thu, 23 May 2024 10:58:29 +0200 Subject: [PATCH] add the table --- .../src/pages/student/CoursesViewStudent.tsx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/student/CoursesViewStudent.tsx b/frontend/src/pages/student/CoursesViewStudent.tsx index 6bb14e8c..add7b240 100644 --- a/frontend/src/pages/student/CoursesViewStudent.tsx +++ b/frontend/src/pages/student/CoursesViewStudent.tsx @@ -15,9 +15,13 @@ export default function CoursesViewStudent(): JSX.Element { const {t} = useTranslation(); const data: coursesStudentLoaderObject = useRouteLoaderData(COURSES_STUDENT_ROUTER_ID) as coursesStudentLoaderObject + const courses_data = data.courses - const tableCoursesActive: TableRowCourses[] = courses_data.map((course: properCourse) => { + const active_courses = courses_data.filter((course: properCourse) => !course.course_archived) + const archived_courses = courses_data.filter((course: properCourse) => course.course_archived) + + const tableCoursesActive: TableRowCourses[] = active_courses.map((course: properCourse) => { const deadline_date = course.first_deadline ? new Date(course.first_deadline) : null @@ -38,6 +42,17 @@ export default function CoursesViewStudent(): JSX.Element { } }) + const tableCoursesArchived: TableRowCourses[] = archived_courses.map((course: properCourse) => { + return { + course: { + name: course.course_name, + id: course.course_id, + }, + firstUpcomingDeadline: "-", + numberOfProjects: 0 + } + }) + return ( <>
@@ -50,6 +65,10 @@ export default function CoursesViewStudent(): JSX.Element {
+
+