From 332ae467fb3e83428ecd65de91ae43598cb98d16 Mon Sep 17 00:00:00 2001 From: femish Date: Wed, 9 Oct 2024 07:40:56 +0530 Subject: [PATCH] adds functionality to play next video automatically --- .../courses/[courseId]/[...moduleId]/page.tsx | 4 +-- src/components/CourseView.tsx | 18 +++++------ src/components/Sidebar.tsx | 4 ++- .../admin/ContentRendererClient.tsx | 31 ++++++++++--------- src/components/comment/CommentVoteForm.tsx | 2 +- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/app/courses/[courseId]/[...moduleId]/page.tsx b/src/app/courses/[courseId]/[...moduleId]/page.tsx index 4e057393d..563ced8f2 100644 --- a/src/app/courses/[courseId]/[...moduleId]/page.tsx +++ b/src/app/courses/[courseId]/[...moduleId]/page.tsx @@ -1,6 +1,6 @@ import { QueryParams } from '@/actions/types'; import { CourseView } from '@/components/CourseView'; -import { getCourse, getFullCourseContent } from '@/db/course'; +import { getCourse, getFullCourseContent, getNextVideo } from '@/db/course'; import findContentById from '@/lib/find-content-by-id'; export default async function Course({ @@ -20,7 +20,7 @@ export default async function Course({ fullCourseContent, rest.map((x) => parseInt(x, 10)), ); - const nextContent = null; //await getNextVideo(Number(rest[rest.length - 1])) + const nextContent = await getNextVideo(Number(rest[rest.length - 1])); return ( -

+
+ {' '} +

Course Content

+
+ +
) : null}

diff --git a/src/components/comment/CommentVoteForm.tsx b/src/components/comment/CommentVoteForm.tsx index 98db02d55..3d79eae67 100644 --- a/src/components/comment/CommentVoteForm.tsx +++ b/src/components/comment/CommentVoteForm.tsx @@ -122,4 +122,4 @@ const CommentVoteForm: React.FC = ({ ); }; -export default CommentVoteForm; \ No newline at end of file +export default CommentVoteForm;