From e239eb5a3137ae3647ec993d27e27333cb0a7bee Mon Sep 17 00:00:00 2001 From: swve Date: Wed, 18 Jun 2025 19:36:49 +0200 Subject: [PATCH] feat: Make the chapter icons clickable in the navigation bar --- .../Pages/Courses/ActivityIndicators.tsx | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/apps/web/components/Pages/Courses/ActivityIndicators.tsx b/apps/web/components/Pages/Courses/ActivityIndicators.tsx index 8d37d0e4..4eef89c9 100644 --- a/apps/web/components/Pages/Courses/ActivityIndicators.tsx +++ b/apps/web/components/Pages/Courses/ActivityIndicators.tsx @@ -235,7 +235,13 @@ function ActivityIndicators(props: Props) { {course.chapters.map((chapter: any, chapterIndex: number) => { const completedActivities = getChapterProgress(chapter.activities); const isChapterComplete = completedActivities === chapter.activities.length; - + const firstActivity = chapter.activities[0]; + const firstActivityId = firstActivity?.activity_uuid?.replace('activity_', ''); + const chapterLinkHref = + firstActivityId + ? getUriWithOrg(orgslug, '') + `/course/${courseid}/activity/${firstActivityId}` + : undefined; + return ( } > -
-
- {chapterIndex + 1} + {chapterLinkHref ? ( + +
+ {chapterIndex + 1} +
+ + ) : ( +
+
+ {chapterIndex + 1} +
-
+ )}
{chapter.activities.map((activity: any) => {