From d24b1a2b1ee9eca0ce4f619ab06370a8ce52ad05 Mon Sep 17 00:00:00 2001 From: iamnithishraja <153272518+iamnithishraja@users.noreply.github.com> Date: Sun, 12 May 2024 18:26:47 +0530 Subject: [PATCH 1/2] added next prev feature --- src/components/CourseView.tsx | 1 + src/components/admin/ContentRenderer.tsx | 6 +- .../admin/ContentRendererClient.tsx | 26 +++++++- src/db/course.ts | 59 +++++++++++++++++++ 4 files changed, 90 insertions(+), 2 deletions(-) diff --git a/src/components/CourseView.tsx b/src/components/CourseView.tsx index 675c9c361..5133719b6 100644 --- a/src/components/CourseView.tsx +++ b/src/components/CourseView.tsx @@ -43,6 +43,7 @@ export const CourseView = ({ {contentType === 'video' ? ( { const session = await getServerSession(authOptions); @@ -61,6 +62,7 @@ export const getMetadata = async (contentId: number) => { export const ContentRenderer = async ({ content, nextContent, + courseId, }: { nextContent: { id: number; @@ -77,11 +79,13 @@ export const ContentRenderer = async ({ markAsCompleted: boolean; bookmark: Bookmark | null; }; + courseId: number; }) => { const metadata = await getMetadata(content.id); - + const prevNextUrls = await getNextPrevUrls(content.id, courseId); return ( { const [contentCompleted, setContentCompleted] = useState( content.markAsCompleted, @@ -34,7 +39,6 @@ export const ContentRendererClient = ({ metadata?.segments?.length > 0, ); const searchParams = useSearchParams(); - const router = useRouter(); //@ts-ignore @@ -150,6 +154,26 @@ export const ContentRendererClient = ({ ) : null} +
+ + +
{!showChapters && metadata.segments?.length > 0 && (