From 483cba979ba070f105b5867c07fe5a18d8e1cc94 Mon Sep 17 00:00:00 2001 From: Theophilus Adesola Date: Sat, 29 Aug 2026 18:05:19 +0100 Subject: [PATCH 1/4] feat: add back button component for nested navigation --- .../[courseId]/modules/[moduleId]/page.tsx | 11 ++-------- src/app/courses/[courseId]/page.tsx | 2 ++ src/app/courses/[courseId]/quiz/page.tsx | 11 ++-------- src/app/credentials/[credentialId]/page.tsx | 2 ++ src/components/shared/back-button.tsx | 22 +++++++++++++++++++ 5 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 src/components/shared/back-button.tsx diff --git a/src/app/courses/[courseId]/modules/[moduleId]/page.tsx b/src/app/courses/[courseId]/modules/[moduleId]/page.tsx index 4075384..79ea4b5 100644 --- a/src/app/courses/[courseId]/modules/[moduleId]/page.tsx +++ b/src/app/courses/[courseId]/modules/[moduleId]/page.tsx @@ -5,6 +5,7 @@ import { useModule, useCourseDetail } from "@/lib/hooks/use-courses"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { LoadingSkeleton } from "@/components/shared/loading-skeleton"; +import { BackButton } from "@/components/shared/back-button"; import { ProgressBar } from "@/components/course/progress-bar"; import { useCourseStore } from "@/store/course-store"; import { useToastContext } from "@/components/shared/toast"; @@ -83,15 +84,7 @@ export default function ModulePage({ return (
{/* Breadcrumb */} -
- - - Back to Course - -
+ {/* Progress */} {courseProgress && ( diff --git a/src/app/courses/[courseId]/page.tsx b/src/app/courses/[courseId]/page.tsx index 136ed0f..512a896 100644 --- a/src/app/courses/[courseId]/page.tsx +++ b/src/app/courses/[courseId]/page.tsx @@ -9,6 +9,7 @@ import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Badge, difficultyVariant } from "@/components/ui/badge"; import { AutoBreadcrumb } from "@/components/ui/breadcrumb"; +import { BackButton } from "@/components/shared/back-button"; import { LoadingSkeleton } from "@/components/shared/loading-skeleton"; import { useToastContext } from "@/components/shared/toast"; import { @@ -86,6 +87,7 @@ export default function CourseDetailPage({ return (
+ -
- - - Back to Course - -
+ }> + {/* Badge */}
router.back()} + className="mb-4 text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100" + aria-label="Go back to previous page" + > +