From 1de782a2b2f15584fce82874bf6c78366178c9bd Mon Sep 17 00:00:00 2001 From: calisio Date: Thu, 16 Jan 2025 11:05:13 -0600 Subject: [PATCH] fix: handle for no activity or courses student layer 2 dash --- .../dashboard/ResidentWeeklyActivityTable.tsx | 2 +- frontend/src/Pages/StudentDashboard.tsx | 32 +++++++++++-------- frontend/src/routeLoaders.ts | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/frontend/src/Components/dashboard/ResidentWeeklyActivityTable.tsx b/frontend/src/Components/dashboard/ResidentWeeklyActivityTable.tsx index 4f8f7d01..fdd5e678 100644 --- a/frontend/src/Components/dashboard/ResidentWeeklyActivityTable.tsx +++ b/frontend/src/Components/dashboard/ResidentWeeklyActivityTable.tsx @@ -18,7 +18,7 @@ export default function ResidentWeeklyActivityTable({ - {courses ? ( + {courses.length > 0 ? ( courses.map( (course: RecentCourse, index: number) => { const totalTime = convertSeconds( diff --git a/frontend/src/Pages/StudentDashboard.tsx b/frontend/src/Pages/StudentDashboard.tsx index 027d65af..d03cc809 100644 --- a/frontend/src/Pages/StudentDashboard.tsx +++ b/frontend/src/Pages/StudentDashboard.tsx @@ -34,19 +34,25 @@ export default function StudentLayer2() {

Hi, {user.name_first ?? 'Student'}!

Pick Up Where You Left Off

-
- {courses - .slice(0, slice) - .map((course: RecentCourse, index: number) => { - return ( - - ); - })} -
+ {courses.length > 0 ? ( +
+ {courses + .slice(0, slice) + .map((course: RecentCourse, index: number) => { + return ( + + ); + })} +
+ ) : ( +

+ You are not currently enrolled in any courses. +

+ )} {courses.length > 4 && (