@sage-rsc/talking-head-react 1.0.53 → 1.0.54
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.
- package/dist/index.cjs +2 -2
- package/dist/index.js +677 -666
- package/package.json +1 -1
- package/src/components/CurriculumLearning.jsx +16 -2
package/package.json
CHANGED
|
@@ -459,11 +459,18 @@ const CurriculumLearning = forwardRef(({
|
|
|
459
459
|
stateRef.current.score = 0;
|
|
460
460
|
stateRef.current.totalQuestions = 0;
|
|
461
461
|
|
|
462
|
+
// Check if there's a next lesson available after this one
|
|
463
|
+
const currentModuleAfterMove = curriculum.modules[stateRef.current.currentModuleIndex];
|
|
464
|
+
const hasNextLessonInModuleAfterMove = stateRef.current.currentLessonIndex < (currentModuleAfterMove?.lessons?.length || 0) - 1;
|
|
465
|
+
const hasNextModuleAfterMove = stateRef.current.currentModuleIndex < (curriculum.modules?.length || 0) - 1;
|
|
466
|
+
const hasNextLessonAfterMove = hasNextLessonInModuleAfterMove || hasNextModuleAfterMove;
|
|
467
|
+
|
|
462
468
|
// Clear current question in UI and notify parent
|
|
463
469
|
callbacksRef.current.onCustomAction({
|
|
464
470
|
type: 'lessonStart',
|
|
465
471
|
moduleIndex: stateRef.current.currentModuleIndex,
|
|
466
|
-
lessonIndex: stateRef.current.currentLessonIndex
|
|
472
|
+
lessonIndex: stateRef.current.currentLessonIndex,
|
|
473
|
+
hasNextLesson: hasNextLessonAfterMove
|
|
467
474
|
});
|
|
468
475
|
|
|
469
476
|
// Notify parent that lesson has changed - parent decides when to start teaching
|
|
@@ -492,11 +499,18 @@ const CurriculumLearning = forwardRef(({
|
|
|
492
499
|
stateRef.current.score = 0;
|
|
493
500
|
stateRef.current.totalQuestions = 0;
|
|
494
501
|
|
|
502
|
+
// Check if there's a next lesson available after this one
|
|
503
|
+
const currentModuleAfterMove = curriculum.modules[stateRef.current.currentModuleIndex];
|
|
504
|
+
const hasNextLessonInModuleAfterMove = stateRef.current.currentLessonIndex < (currentModuleAfterMove?.lessons?.length || 0) - 1;
|
|
505
|
+
const hasNextModuleAfterMove = stateRef.current.currentModuleIndex < (curriculum.modules?.length || 0) - 1;
|
|
506
|
+
const hasNextLessonAfterMove = hasNextLessonInModuleAfterMove || hasNextModuleAfterMove;
|
|
507
|
+
|
|
495
508
|
// Clear current question in UI and notify parent
|
|
496
509
|
callbacksRef.current.onCustomAction({
|
|
497
510
|
type: 'lessonStart',
|
|
498
511
|
moduleIndex: stateRef.current.currentModuleIndex,
|
|
499
|
-
lessonIndex: stateRef.current.currentLessonIndex
|
|
512
|
+
lessonIndex: stateRef.current.currentLessonIndex,
|
|
513
|
+
hasNextLesson: hasNextLessonAfterMove
|
|
500
514
|
});
|
|
501
515
|
|
|
502
516
|
// Notify parent that lesson has changed - parent decides when to start teaching
|