fix: v1 lesson section creation
This commit is contained in:
@@ -108,7 +108,7 @@
|
||||
{#each $lessonSections as section (section.id)}
|
||||
<div class="mb-3 border border-gray-200 rounded-md">
|
||||
<div
|
||||
class="mb-2 px-3 py-1 border-b bg-gray-50 rounded-tl-md rounded-tr-md flex justify-between items-center"
|
||||
class="mb-2 px-3 py-1 min-h-[50px] border-b bg-gray-50 rounded-tl-md rounded-tr-md flex justify-between items-center"
|
||||
>
|
||||
{#if lessonEditing === section.id}
|
||||
<TextField className="w-4/6" bind:value={section.title} errorMessage={errors?.title} />
|
||||
|
||||
@@ -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]) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
|
||||
function addLesson() {
|
||||
$handleAddLessonWidget.open = true;
|
||||
$handleAddLessonWidget.isSection = true;
|
||||
|
||||
$handleAddLessonWidget.isSection = $course.version === COURSE_VERSION.V2;
|
||||
}
|
||||
|
||||
function hasUserCompletedLesson(completion) {
|
||||
|
||||
Reference in New Issue
Block a user