diff --git a/apps/dashboard/src/lib/components/Course/components/Lesson/LessonSectionList.svelte b/apps/dashboard/src/lib/components/Course/components/Lesson/LessonSectionList.svelte index e1650c11..b9c4c11a 100644 --- a/apps/dashboard/src/lib/components/Course/components/Lesson/LessonSectionList.svelte +++ b/apps/dashboard/src/lib/components/Course/components/Lesson/LessonSectionList.svelte @@ -108,7 +108,7 @@ {#each $lessonSections as section (section.id)}
{#if lessonEditing === section.id} diff --git a/apps/dashboard/src/lib/components/Course/components/Lesson/NewLessonModal.svelte b/apps/dashboard/src/lib/components/Course/components/Lesson/NewLessonModal.svelte index a0e8cf3b..a01beb96 100644 --- a/apps/dashboard/src/lib/components/Course/components/Lesson/NewLessonModal.svelte +++ b/apps/dashboard/src/lib/components/Course/components/Lesson/NewLessonModal.svelte @@ -57,13 +57,14 @@ title: lesson.title, order: newLessonSection.order, course_id: newLessonSection.course_id, - lessons: [] + lessons: [], + created_at: '' } ]; }); } } else { - lesson.section_id = $handleAddLessonWidget.id; + lesson.section_id = $handleAddLessonWidget.id || undefined; const savedLesson = await handleSaveLesson(lesson, $course.id); if (Array.isArray(savedLesson) && savedLesson[0]) { diff --git a/apps/dashboard/src/lib/components/Course/components/Navigation/NavExpandable.svelte b/apps/dashboard/src/lib/components/Course/components/Navigation/NavExpandable.svelte index 1899a5d4..e26bb368 100644 --- a/apps/dashboard/src/lib/components/Course/components/Navigation/NavExpandable.svelte +++ b/apps/dashboard/src/lib/components/Course/components/Navigation/NavExpandable.svelte @@ -9,6 +9,7 @@ import { isFreePlan } from '$lib/utils/store/org'; import { goto } from '$app/navigation'; import { course } from '$lib/components/Course/store'; + import { COURSE_VERSION } from '$lib/utils/types'; export let handleClick = () => {}; export let id = ''; @@ -28,11 +29,14 @@ function addLesson() { goto('/courses/' + $course.id + '/lessons'); $handleAddLessonWidget.open = true; - // If it is section, then add lesson to section - $handleAddLessonWidget.isSection = isSection ? false : true; - if (isSection) { - $handleAddLessonWidget.id = id; + if ($course.version === COURSE_VERSION.V2) { + // If it is section, then add lesson to section + $handleAddLessonWidget.isSection = isSection ? false : true; + + if (isSection) { + $handleAddLessonWidget.id = id; + } } } diff --git a/apps/dashboard/src/routes/courses/[id]/lessons/+page.svelte b/apps/dashboard/src/routes/courses/[id]/lessons/+page.svelte index c8cd4378..6940b9ac 100644 --- a/apps/dashboard/src/routes/courses/[id]/lessons/+page.svelte +++ b/apps/dashboard/src/routes/courses/[id]/lessons/+page.svelte @@ -36,7 +36,8 @@ function addLesson() { $handleAddLessonWidget.open = true; - $handleAddLessonWidget.isSection = true; + + $handleAddLessonWidget.isSection = $course.version === COURSE_VERSION.V2; } function hasUserCompletedLesson(completion) {