@selfcommunity/react-templates 0.4.5-courses.143 → 0.4.5-courses.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -62,7 +62,7 @@ function Lesson(inProps) {
|
|
|
62
62
|
const currentData = (0, react_1.useMemo)(() => {
|
|
63
63
|
if (!scCourse || !scLesson)
|
|
64
64
|
return null;
|
|
65
|
-
return (0, react_ui_1.getCurrentSectionAndLessonIndex)(scCourse,
|
|
65
|
+
return (0, react_ui_1.getCurrentSectionAndLessonIndex)(scCourse, _sectionId, _lessonId);
|
|
66
66
|
}, [scCourse, scLesson]);
|
|
67
67
|
const [currentSectionIndex, setCurrentSectionIndex] = (0, react_1.useState)((currentData === null || currentData === void 0 ? void 0 : currentData.currentSectionIndex) || 0);
|
|
68
68
|
const [currentLessonIndex, setCurrentLessonIndex] = (0, react_1.useState)((currentData === null || currentData === void 0 ? void 0 : currentData.currentLessonIndex) || 0);
|
|
@@ -170,7 +170,7 @@ function Lesson(inProps) {
|
|
|
170
170
|
? Object.assign(Object.assign({}, lesson), { completion_status: c ? types_1.SCCourseLessonCompletionStatusType.UNCOMPLETED : types_1.SCCourseLessonCompletionStatusType.COMPLETED }) : lesson) }))), num_lessons_completed: c ? scCourse.num_lessons_completed - 1 : scCourse.num_lessons_completed + 1 });
|
|
171
171
|
setSCCourse(updatedCourse);
|
|
172
172
|
//TODO: fix it
|
|
173
|
-
if (
|
|
173
|
+
if (scCourse.num_lessons - scCourse.num_lessons_completed === 1) {
|
|
174
174
|
setOpenDialog(true);
|
|
175
175
|
}
|
|
176
176
|
})
|
|
@@ -60,7 +60,7 @@ export default function Lesson(inProps) {
|
|
|
60
60
|
const currentData = useMemo(() => {
|
|
61
61
|
if (!scCourse || !scLesson)
|
|
62
62
|
return null;
|
|
63
|
-
return getCurrentSectionAndLessonIndex(scCourse,
|
|
63
|
+
return getCurrentSectionAndLessonIndex(scCourse, _sectionId, _lessonId);
|
|
64
64
|
}, [scCourse, scLesson]);
|
|
65
65
|
const [currentSectionIndex, setCurrentSectionIndex] = useState((currentData === null || currentData === void 0 ? void 0 : currentData.currentSectionIndex) || 0);
|
|
66
66
|
const [currentLessonIndex, setCurrentLessonIndex] = useState((currentData === null || currentData === void 0 ? void 0 : currentData.currentLessonIndex) || 0);
|
|
@@ -168,7 +168,7 @@ export default function Lesson(inProps) {
|
|
|
168
168
|
? Object.assign(Object.assign({}, lesson), { completion_status: c ? SCCourseLessonCompletionStatusType.UNCOMPLETED : SCCourseLessonCompletionStatusType.COMPLETED }) : lesson) }))), num_lessons_completed: c ? scCourse.num_lessons_completed - 1 : scCourse.num_lessons_completed + 1 });
|
|
169
169
|
setSCCourse(updatedCourse);
|
|
170
170
|
//TODO: fix it
|
|
171
|
-
if (
|
|
171
|
+
if (scCourse.num_lessons - scCourse.num_lessons_completed === 1) {
|
|
172
172
|
setOpenDialog(true);
|
|
173
173
|
}
|
|
174
174
|
})
|