From df1273102696817333c3a9a1124f922dc03b1d26 Mon Sep 17 00:00:00 2001 From: swve Date: Thu, 27 Feb 2025 15:06:08 +0100 Subject: [PATCH] refactor: Improve Activity Navigation Layout and Responsiveness --- .../activity/[activityid]/activity.tsx | 142 ++++++++++++------ 1 file changed, 96 insertions(+), 46 deletions(-) diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/activity.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/activity.tsx index 1a588f79..42e59470 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/activity.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/activity.tsx @@ -3,7 +3,7 @@ import Link from 'next/link' import { getAPIUrl, getUriWithOrg } from '@services/config/config' import Canva from '@components/Objects/Activities/DynamicCanva/DynamicCanva' import VideoActivity from '@components/Objects/Activities/Video/Video' -import { BookOpenCheck, Check, CheckCircle, ChevronDown, ChevronLeft, ChevronRight, FileText, Folder, List, Menu, MoreVertical, UserRoundPen, Video, Layers, ListFilter, ListTree } from 'lucide-react' +import { BookOpenCheck, Check, CheckCircle, ChevronDown, ChevronLeft, ChevronRight, FileText, Folder, List, Menu, MoreVertical, UserRoundPen, Video, Layers, ListFilter, ListTree, X } from 'lucide-react' import { markActivityAsComplete } from '@services/courses/activity' import DocumentPdfActivity from '@components/Objects/Activities/DocumentPdf/DocumentPdf' import ActivityIndicators from '@components/Pages/Courses/ActivityIndicators' @@ -476,7 +476,7 @@ function ActivityChapterDropdown(props: { onClick={() => setIsOpen(false)} className="text-gray-500 hover:text-gray-700 p-1 rounded-full hover:bg-gray-100" > - + @@ -624,55 +624,105 @@ function ActivityNavigation(props: { // Navigation buttons component - reused for both top and bottom const NavigationButtons = ({ isFloating = false }) => ( -
- - -
- {currentIndex + 1} of {allActivities.length} -
- - +
+ {isFloating ? ( + // Floating navigation - original flex layout + <> + + + + + ) : ( + // Regular navigation - grid layout with centered counter + <> +
+ +
+ +
+ {currentIndex + 1} of {allActivities.length} +
+ +
+ +
+ + )}
); return ( <> {/* Bottom navigation (in-place) */} -
+
@@ -680,7 +730,7 @@ function ActivityNavigation(props: { {!isBottomNavVisible && (