From 440e22fa28ee0dd533b72ab6bd8b83fd400cdc9b Mon Sep 17 00:00:00 2001 From: swve Date: Thu, 27 Feb 2025 11:23:54 +0100 Subject: [PATCH] feat: Drastically improve Course navigation --- .../activity/[activityid]/activity.tsx | 315 +++++++++++++++++- 1 file changed, 306 insertions(+), 9 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 20d03e54..1a588f79 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, MoreVertical, UserRoundPen } from 'lucide-react' +import { BookOpenCheck, Check, CheckCircle, ChevronDown, ChevronLeft, ChevronRight, FileText, Folder, List, Menu, MoreVertical, UserRoundPen, Video, Layers, ListFilter, ListTree } from 'lucide-react' import { markActivityAsComplete } from '@services/courses/activity' import DocumentPdfActivity from '@components/Objects/Activities/DocumentPdf/DocumentPdf' import ActivityIndicators from '@components/Pages/Courses/ActivityIndicators' @@ -121,13 +121,20 @@ function ActivityClient(props: ActivityClientProps) { />
-
-

- Chapter : {getChapterNameByActivityId(course, activity.id)} -

-

- {activity.name} -

+
+ +
+

+ Chapter : {getChapterNameByActivityId(course, activity.id)} +

+

+ {activity.name} +

+
{activity && activity.published == true && activity.content.paid_access != false && ( @@ -213,6 +220,16 @@ function ActivityClient(props: ActivityClientProps) { )} )} + + {/* Activity Navigation */} + {activity && activity.published == true && activity.content.paid_access != false && ( + + )} + {
}
@@ -235,7 +252,7 @@ export function MarkStatus(props: { const trail = await markActivityAsComplete( props.orgslug, props.course.course_uuid, - 'activity_' + props.activityid, + props.activity.activity_uuid, session.data?.tokens?.access_token ) router.refresh() @@ -393,4 +410,284 @@ function AssignmentTools(props: { return null } +function ActivityChapterDropdown(props: { + course: any + currentActivityId: string + orgslug: string +}): React.ReactNode { + const [isOpen, setIsOpen] = React.useState(false); + const dropdownRef = React.useRef(null); + const isMobile = useMediaQuery('(max-width: 768px)'); + + // Close dropdown when clicking outside + React.useEffect(() => { + function handleClickOutside(event: MouseEvent) { + if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) { + setIsOpen(false); + } + } + document.addEventListener('mousedown', handleClickOutside); + return () => { + document.removeEventListener('mousedown', handleClickOutside); + }; + }, []); + + const toggleDropdown = () => { + setIsOpen(!isOpen); + }; + + // Function to get the appropriate icon for activity type + const getActivityTypeIcon = (activityType: string) => { + switch (activityType) { + case 'TYPE_VIDEO': + return