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 1752862e..6ae554ff 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 @@ -260,14 +260,26 @@ export function MarkStatus(props: { const router = useRouter() const session = useLHSession() as any; const isMobile = useMediaQuery('(max-width: 768px)') + const [isLoading, setIsLoading] = React.useState(false); + async function markActivityAsCompleteFront() { - const trail = await markActivityAsComplete( - props.orgslug, - props.course.course_uuid, - props.activity.activity_uuid, - session.data?.tokens?.access_token - ) - router.refresh() + try { + setIsLoading(true); + const trail = await markActivityAsComplete( + props.orgslug, + props.course.course_uuid, + props.activity.activity_uuid, + session.data?.tokens?.access_token + ); + + // Mutate the course data to trigger re-render + await mutate(`${getAPIUrl()}courses/${props.course.course_uuid}/meta`); + router.refresh(); + } catch (error) { + toast.error('Failed to mark activity as complete'); + } finally { + setIsLoading(false); + } } const isActivityCompleted = () => { @@ -284,7 +296,7 @@ export function MarkStatus(props: { return ( <> {isActivityCompleted() ? ( -
+
{' '} @@ -292,14 +304,22 @@ export function MarkStatus(props: {
) : (
- {' '} - - - {' '} - {!isMobile && Mark as complete} + {isLoading ? ( +
+ + + + +
+ ) : ( + + + + )}{' '} + {!isMobile && {isLoading ? 'Marking...' : 'Mark as complete'}}
)} diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/page.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/page.tsx index d8341cd7..470251d0 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/page.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/page.tsx @@ -21,7 +21,7 @@ type Session = { async function fetchCourseMetadata(courseuuid: string, access_token: string | null | undefined) { return await getCourseMetadata( courseuuid, - { revalidate: 1800, tags: ['courses'] }, + { revalidate: 0, tags: ['courses'] }, access_token || null ) } diff --git a/apps/web/components/Objects/StyledElements/Tooltip/Tooltip.tsx b/apps/web/components/Objects/StyledElements/Tooltip/Tooltip.tsx index 91495910..173f804f 100644 --- a/apps/web/components/Objects/StyledElements/Tooltip/Tooltip.tsx +++ b/apps/web/components/Objects/StyledElements/Tooltip/Tooltip.tsx @@ -9,6 +9,7 @@ type TooltipProps = { children: React.ReactNode side?: 'top' | 'right' | 'bottom' | 'left' // default is bottom slateBlack?: boolean + unstyled?: boolean // new prop to remove default styling } const ToolTip = (props: TooltipProps) => { @@ -19,6 +20,7 @@ const ToolTip = (props: TooltipProps) => { @@ -63,6 +65,17 @@ const TooltipContent = styled(Tooltip.Content, { color: 'white', }, }, + unstyled: { + true: { + padding: 0, + backgroundColor: 'transparent', + boxShadow: 'none', + borderRadius: 0, + fontSize: 'inherit', + lineHeight: 'inherit', + color: 'inherit', + }, + }, }, borderRadius: 4, diff --git a/apps/web/components/Pages/Courses/ActivityIndicators.tsx b/apps/web/components/Pages/Courses/ActivityIndicators.tsx index 230624c8..13482de8 100644 --- a/apps/web/components/Pages/Courses/ActivityIndicators.tsx +++ b/apps/web/components/Pages/Courses/ActivityIndicators.tsx @@ -2,6 +2,7 @@ import ToolTip from '@components/Objects/StyledElements/Tooltip/Tooltip' import { getUriWithOrg } from '@services/config/config' import Link from 'next/link' import React from 'react' +import { Video, FileText, Layers, BookOpenCheck, Check } from 'lucide-react' interface Props { course: any @@ -16,7 +17,7 @@ function ActivityIndicators(props: Props) { const courseid = props.course_uuid.replace('course_', '') const done_activity_style = 'bg-teal-600 hover:bg-teal-700' - const black_activity_style = 'bg-black hover:bg-gray-700' + const black_activity_style = 'bg-zinc-300 hover:bg-zinc-400' const current_activity_style = 'bg-gray-600 animate-pulse hover:bg-gray-700' const trail = props.course.trail @@ -50,6 +51,51 @@ function ActivityIndicators(props: Props) { return black_activity_style } + const getActivityTypeIcon = (activityType: string) => { + switch (activityType) { + case 'TYPE_VIDEO': + return