diff --git a/src/components/content/courses/CombinedLesson.js b/src/components/content/courses/CombinedLesson.js
index 0175a35..13abd8e 100644
--- a/src/components/content/courses/CombinedLesson.js
+++ b/src/components/content/courses/CombinedLesson.js
@@ -269,33 +269,49 @@ const CombinedLesson = ({ lesson, course, decryptionPerformed, isPaid, setComple
{!isVideo && }
{lesson?.additionalLinks && lesson.additionalLinks.length > 0 && (
-
-
External links:
-
+
+
+
+
+
+ menuRef.current.toggle(e)}
+ aria-label="More options"
+ className="p-button-text"
+ tooltip={isMobileView ? null : "More options"}
+ tooltipOptions={{ position: 'top' }}
+ />
+
+
+
+ )}
+ {!lesson?.additionalLinks || lesson.additionalLinks.length === 0 && (
+
+
+ menuRef.current.toggle(e)}
+ aria-label="More options"
+ className="p-button-text"
+ tooltip={isMobileView ? null : "More options"}
+ tooltipOptions={{ position: 'top' }}
+ />
)}
{!isVideo && renderContent()}
-
-
-
- menuRef.current.toggle(e)}
- aria-label="More options"
- className="p-button-text"
- tooltip={isMobileView ? null : "More options"}
- tooltipOptions={{ position: 'top' }}
- />
-
);
};
diff --git a/src/components/content/courses/CourseLesson.js b/src/components/content/courses/CourseLesson.js
index 8e00cf7..11c7a23 100644
--- a/src/components/content/courses/CourseLesson.js
+++ b/src/components/content/courses/CourseLesson.js
@@ -116,16 +116,44 @@ const CourseLesson = ({ lesson, course, decryptionPerformed, isPaid, setComplete
{lesson?.additionalLinks && lesson.additionalLinks.length > 0 && (
-
External links:
-
+
+
+
+
+ menuRef.current.toggle(e)}
+ aria-label="More options"
+ className="p-button-text"
+ tooltip={isMobileView ? null : "More options"}
+ tooltipOptions={{ position: 'top' }}
+ />
+
+
+
+ )}
+ {!lesson?.additionalLinks || lesson.additionalLinks.length === 0 && (
+
+
+ menuRef.current.toggle(e)}
+ aria-label="More options"
+ className="p-button-text"
+ tooltip={isMobileView ? null : "More options"}
+ tooltipOptions={{ position: 'top' }}
+ />
)}
@@ -165,18 +193,6 @@ const CourseLesson = ({ lesson, course, decryptionPerformed, isPaid, setComplete
{renderContent()}
-
-
-
- menuRef.current.toggle(e)}
- aria-label="More options"
- className="p-button-text"
- tooltip={isMobileView ? null : "More options"}
- tooltipOptions={{ position: 'top' }}
- />
-
)
}
diff --git a/src/components/content/courses/DocumentLesson.js b/src/components/content/courses/DocumentLesson.js
index 5efecab..18c7a26 100644
--- a/src/components/content/courses/DocumentLesson.js
+++ b/src/components/content/courses/DocumentLesson.js
@@ -1,4 +1,4 @@
-import React, { useEffect, useState } from "react";
+import React, { useEffect, useState, useRef } from "react";
import { Tag } from "primereact/tag";
import Image from "next/image";
import ZapDisplay from "@/components/zaps/ZapDisplay";
@@ -12,6 +12,8 @@ import dynamic from "next/dynamic";
import useWindowWidth from "@/hooks/useWindowWidth";
import appConfig from "@/config/appConfig";
import useTrackDocumentLesson from "@/hooks/tracking/useTrackDocumentLesson";
+import { Menu } from "primereact/menu";
+import { Toast } from "primereact/toast";
const MDDisplay = dynamic(
() => import("@uiw/react-markdown-preview"),
@@ -27,16 +29,45 @@ const DocumentLesson = ({ lesson, course, decryptionPerformed, isPaid, setComple
const { returnImageProxy } = useImageProxy();
const windowWidth = useWindowWidth();
const isMobileView = windowWidth <= 768;
+ const menuRef = useRef(null);
+ const toastRef = useRef(null);
// todo implement real read time needs to be on form
const readTime = 120;
- const { isCompleted, isTracking } = useTrackDocumentLesson({
+ const { isCompleted, isTracking, markLessonAsCompleted } = useTrackDocumentLesson({
lessonId: lesson?.d,
courseId: course?.d,
readTime: readTime,
paidCourse: isPaid,
decryptionPerformed: decryptionPerformed,
});
+
+ const menuItems = [
+ {
+ label: 'Mark as completed',
+ icon: 'pi pi-check-circle',
+ command: async () => {
+ try {
+ await markLessonAsCompleted();
+ setCompleted && setCompleted(lesson.id);
+ toastRef.current.show({
+ severity: 'success',
+ summary: 'Success',
+ detail: 'Lesson marked as completed',
+ life: 3000
+ });
+ } catch (error) {
+ console.error('Failed to mark lesson as completed:', error);
+ toastRef.current.show({
+ severity: 'error',
+ summary: 'Error',
+ detail: 'Failed to mark lesson as completed',
+ life: 3000
+ });
+ }
+ }
+ }
+ ];
useEffect(() => {
if (!zaps || zapsLoading || zapsError) return;
@@ -86,6 +117,7 @@ const DocumentLesson = ({ lesson, course, decryptionPerformed, isPaid, setComple
return (
+
- {lesson?.additionalLinks && lesson.additionalLinks.length > 0 && (
-
- )}
+ {lesson?.additionalLinks && lesson.additionalLinks.length > 0 && (
+
+
+
+
+
+ menuRef.current.toggle(e)}
+ aria-label="More options"
+ className="p-button-text"
+ tooltip={isMobileView ? null : "More options"}
+ tooltipOptions={{ position: 'top' }}
+ />
+
+
+
+ )}
+ {!lesson?.additionalLinks || lesson.additionalLinks.length === 0 && (
+
+
+ menuRef.current.toggle(e)}
+ aria-label="More options"
+ className="p-button-text"
+ tooltip={isMobileView ? null : "More options"}
+ tooltipOptions={{ position: 'top' }}
+ />
+
+ )}
{renderContent()}
diff --git a/src/components/content/courses/VideoLesson.js b/src/components/content/courses/VideoLesson.js
index 98b4b04..e11c012 100644
--- a/src/components/content/courses/VideoLesson.js
+++ b/src/components/content/courses/VideoLesson.js
@@ -238,30 +238,46 @@ const VideoLesson = ({ lesson, course, decryptionPerformed, isPaid, setCompleted
{lesson?.additionalLinks && lesson.additionalLinks.length > 0 && (
-
External links:
-
+
+
+
+
+ menuRef.current.toggle(e)}
+ aria-label="More options"
+ className="p-button-text"
+ tooltip={isMobileView ? null : "More options"}
+ tooltipOptions={{ position: 'top' }}
+ />
+
+
+
+ )}
+ {!lesson?.additionalLinks || lesson.additionalLinks.length === 0 && (
+
+
+ menuRef.current.toggle(e)}
+ aria-label="More options"
+ className="p-button-text"
+ tooltip={isMobileView ? null : "More options"}
+ tooltipOptions={{ position: 'top' }}
+ />
)}
-
-
-
-
- menuRef.current.toggle(e)}
- aria-label="More options"
- className="p-button-text"
- tooltip={isMobileView ? null : "More options"}
- tooltipOptions={{ position: 'top' }}
- />
)