From 54ec3df1d70819018a99b1851a4cbc49899e1b27 Mon Sep 17 00:00:00 2001 From: austinkelsay Date: Wed, 2 Apr 2025 17:14:39 -0500 Subject: [PATCH] Course page now has sidebar for lessons selection, basic tab menu on mobile to go to lessons tab or content tab --- .../content/courses/CourseSidebar.js | 110 ++++++++++++++++++ src/pages/course/[slug]/index.js | 3 +- 2 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 src/components/content/courses/CourseSidebar.js diff --git a/src/components/content/courses/CourseSidebar.js b/src/components/content/courses/CourseSidebar.js new file mode 100644 index 0000000..95cee03 --- /dev/null +++ b/src/components/content/courses/CourseSidebar.js @@ -0,0 +1,110 @@ +import React from 'react'; +import { Tag } from 'primereact/tag'; +import { Button } from 'primereact/button'; +import Image from 'next/image'; +import { useImageProxy } from '@/hooks/useImageProxy'; + +const CourseSidebar = ({ + lessons, + activeIndex, + onLessonSelect, + completedLessons, + isMobileView, + onClose, + sidebarVisible +}) => { + const { returnImageProxy } = useImageProxy(); + + const LessonItem = ({ lesson, index }) => ( +
  • onLessonSelect(index)} + > +
    + {lesson.image && ( +
    + {`Lesson +
    + )} +
    +
    + + Lesson {index + 1} + + {completedLessons.includes(lesson.id) && ( + + )} +
    +

    + {lesson.title} +

    +
    +
    +
  • + ); + + // For desktop sidebar + const DesktopSidebarContent = () => ( +
    +
    +
    +

    Course Lessons

    +
    +
    +
      + {lessons.map((lesson, index) => ( + + ))} +
    +
    +
    +
    + ); + + // For mobile sidebar + const MobileSidebarContent = () => ( +
    +
    +

    Course Lessons

    +
    + +
    + ); + + // Desktop sidebar + if (!isMobileView) { + return ( +
    + +
    + ); + } + + // Mobile sidebar - now integrated with tab system + if (isMobileView && sidebarVisible) { + return ( +
    + +
    + ); + } + + return null; +}; + +export default CourseSidebar; \ No newline at end of file diff --git a/src/pages/course/[slug]/index.js b/src/pages/course/[slug]/index.js index a99ef5e..c667716 100644 --- a/src/pages/course/[slug]/index.js +++ b/src/pages/course/[slug]/index.js @@ -7,8 +7,7 @@ import DocumentLesson from '@/components/content/courses/DocumentLesson'; import CombinedLesson from '@/components/content/courses/CombinedLesson'; import { useNDKContext } from '@/context/NDKContext'; import { useSession } from 'next-auth/react'; -import axios from 'axios'; -import { nip04, nip19 } from 'nostr-tools'; +import { nip19 } from 'nostr-tools'; import { useToast } from '@/hooks/useToast'; import { ProgressSpinner } from 'primereact/progressspinner'; import { Accordion, AccordionTab } from 'primereact/accordion';