@nualang/nualang-ui-components 0.1.1280 → 0.1.1282
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.
|
@@ -504,6 +504,9 @@ function Classroom({
|
|
|
504
504
|
isLoadingAssignments,
|
|
505
505
|
...otherProps
|
|
506
506
|
}) {
|
|
507
|
+
// ensure these exist before any use (avoids TDZ / ReferenceError)
|
|
508
|
+
let tabs = [];
|
|
509
|
+
let classroomCreatorWelcome = "classroom_creator_welcome";
|
|
507
510
|
const {
|
|
508
511
|
handleJoinMeeting,
|
|
509
512
|
discussions,
|
|
@@ -555,16 +558,89 @@ function Classroom({
|
|
|
555
558
|
const [scrollToDiscuss, setScrollToDiscuss] = (0, _react.useState)(false);
|
|
556
559
|
const [scrollToDynamicResponses, setScrollToDynamicResponses] = (0, _react.useState)(false);
|
|
557
560
|
const [displayDynamicAiDialog, setDisplayDynamicAiDialog] = (0, _react.useState)(false);
|
|
561
|
+
const [scheduledDynamicAi, setScheduledDynamicAi] = (0, _react.useState)(false);
|
|
558
562
|
const isWaysideClassroom = classroom?.classroomId?.toLowerCase().includes("wayside");
|
|
559
563
|
const [isSubscriptionExpired, setIsSubscriptionExpired] = (0, _react.useState)(false);
|
|
560
|
-
|
|
564
|
+
|
|
565
|
+
// Joyride steps & state must be declared before any useEffect that reads `run`
|
|
566
|
+
const joyrideSteps = [{
|
|
567
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
568
|
+
children: t(`${classroomCreatorWelcome}`)
|
|
569
|
+
}),
|
|
570
|
+
placement: "center",
|
|
571
|
+
target: "body"
|
|
572
|
+
}, {
|
|
573
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
574
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
575
|
+
children: t("classroom_creator_add_courses")
|
|
576
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
577
|
+
children: t("classroom_creator_add_courses_desc")
|
|
578
|
+
})]
|
|
579
|
+
}),
|
|
580
|
+
spotlightPadding: 8,
|
|
581
|
+
target: "#add-courses-fab"
|
|
582
|
+
}, {
|
|
583
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
584
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
585
|
+
children: t("classroom_creator_add_students_email")
|
|
586
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
587
|
+
children: t("classroom_creator_add_students_email_desc")
|
|
588
|
+
})]
|
|
589
|
+
}),
|
|
590
|
+
spotlightPadding: 8,
|
|
591
|
+
target: "#invite"
|
|
592
|
+
}, {
|
|
593
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
594
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
595
|
+
children: t("classroom_creator_play_live_game")
|
|
596
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
597
|
+
children: t("classroom_creator_play_live_game_desc")
|
|
598
|
+
})]
|
|
599
|
+
}),
|
|
600
|
+
spotlightPadding: 8,
|
|
601
|
+
target: "#play-live"
|
|
602
|
+
}, {
|
|
603
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
604
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
605
|
+
children: t("classroom_creator_track_progress")
|
|
606
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
607
|
+
children: t("classroom_creator_track_progress_desc")
|
|
608
|
+
})]
|
|
609
|
+
}),
|
|
610
|
+
spotlightPadding: 8,
|
|
611
|
+
target: "#Progress"
|
|
612
|
+
}];
|
|
613
|
+
const [joyrideState, setJoyrideState] = (0, _react.useState)({
|
|
614
|
+
run: false,
|
|
615
|
+
steps: joyrideSteps
|
|
616
|
+
});
|
|
617
|
+
const {
|
|
618
|
+
run,
|
|
619
|
+
steps
|
|
620
|
+
} = joyrideState;
|
|
561
621
|
(0, _react.useEffect)(() => {
|
|
562
622
|
const hasDisplayed = localStorage.getItem("displayDynamicAiDialog");
|
|
563
623
|
if (!hasDisplayed && classroom?.isCreator) {
|
|
624
|
+
setScheduledDynamicAi(true);
|
|
625
|
+
}
|
|
626
|
+
}, [classroom]);
|
|
627
|
+
(0, _react.useEffect)(() => {
|
|
628
|
+
if (scheduledDynamicAi && !run && !isPictureDialogOpen) {
|
|
564
629
|
setDisplayDynamicAiDialog(true);
|
|
630
|
+
setScheduledDynamicAi(false);
|
|
631
|
+
// mark as displayed so it won't re-run on future page loads
|
|
565
632
|
localStorage.setItem("displayDynamicAiDialog", "true");
|
|
566
633
|
}
|
|
567
|
-
}, [
|
|
634
|
+
}, [scheduledDynamicAi, run, isPictureDialogOpen]);
|
|
635
|
+
const handleUpdateAvatarAndLearnLang = () => {
|
|
636
|
+
if (!attributes || !attributes.picture) {
|
|
637
|
+
setIsPictureDialogOpen(true);
|
|
638
|
+
}
|
|
639
|
+
if ((!attributes || !attributes[`custom:learnLang`]) && classroom && classroom.learnLang) {
|
|
640
|
+
handleUpdateUserLearnLang(classroom.learnLang);
|
|
641
|
+
}
|
|
642
|
+
localStorage.setItem(`classroom-update-avatar-prompt-${username}`, "true");
|
|
643
|
+
};
|
|
568
644
|
(0, _react.useEffect)(() => {
|
|
569
645
|
if (creatorSubscription?.isPaidUser === false) {
|
|
570
646
|
setIsSubscriptionExpired(true);
|
|
@@ -625,79 +701,12 @@ function Classroom({
|
|
|
625
701
|
};
|
|
626
702
|
const condition = !loading && !isCoursesLoading && assignments?.length > 0;
|
|
627
703
|
useSetLastFetched(condition, assignments, setHasNewAssignments);
|
|
628
|
-
|
|
629
|
-
if (freeTrial) {
|
|
630
|
-
classroomCreatorWelcome = "classroom_creator_welcome_free_trial";
|
|
631
|
-
}
|
|
632
|
-
const joyrideSteps = [{
|
|
633
|
-
content: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
634
|
-
children: t(`${classroomCreatorWelcome}`)
|
|
635
|
-
}),
|
|
636
|
-
placement: "center",
|
|
637
|
-
target: "body"
|
|
638
|
-
}, {
|
|
639
|
-
content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
640
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
641
|
-
children: t("classroom_creator_add_courses")
|
|
642
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
643
|
-
children: t("classroom_creator_add_courses_desc")
|
|
644
|
-
})]
|
|
645
|
-
}),
|
|
646
|
-
spotlightPadding: 8,
|
|
647
|
-
target: "#add-courses-fab"
|
|
648
|
-
}, {
|
|
649
|
-
content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
650
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
651
|
-
children: t("classroom_creator_add_students_email")
|
|
652
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
653
|
-
children: t("classroom_creator_add_students_email_desc")
|
|
654
|
-
})]
|
|
655
|
-
}),
|
|
656
|
-
spotlightPadding: 8,
|
|
657
|
-
target: "#invite"
|
|
658
|
-
}, {
|
|
659
|
-
content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
660
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
661
|
-
children: t("classroom_creator_play_live_game")
|
|
662
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
663
|
-
children: t("classroom_creator_play_live_game_desc")
|
|
664
|
-
})]
|
|
665
|
-
}),
|
|
666
|
-
spotlightPadding: 8,
|
|
667
|
-
target: "#play-live"
|
|
668
|
-
}, {
|
|
669
|
-
content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
670
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
671
|
-
children: t("classroom_creator_track_progress")
|
|
672
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
673
|
-
children: t("classroom_creator_track_progress_desc")
|
|
674
|
-
})]
|
|
675
|
-
}),
|
|
676
|
-
spotlightPadding: 8,
|
|
677
|
-
target: "#Progress"
|
|
678
|
-
}];
|
|
679
|
-
const [joyrideState, setJoyrideState] = (0, _react.useState)({
|
|
680
|
-
run: false,
|
|
681
|
-
steps: joyrideSteps
|
|
682
|
-
});
|
|
683
|
-
const {
|
|
684
|
-
run,
|
|
685
|
-
steps
|
|
686
|
-
} = joyrideState;
|
|
687
|
-
const handleUpdateAvatarAndLearnLang = () => {
|
|
688
|
-
if (!attributes || !attributes.picture) {
|
|
689
|
-
setIsPictureDialogOpen(true);
|
|
690
|
-
}
|
|
691
|
-
if ((!attributes || !attributes[`custom:learnLang`]) && classroom && classroom.learnLang) {
|
|
692
|
-
handleUpdateUserLearnLang(classroom.learnLang);
|
|
693
|
-
}
|
|
694
|
-
localStorage.setItem(`classroom-update-avatar-prompt-${username}`, "true");
|
|
695
|
-
};
|
|
704
|
+
classroomCreatorWelcome = freeTrial ? "classroom_creator_welcome_free_trial" : classroomCreatorWelcome;
|
|
696
705
|
(0, _react.useEffect)(() => {
|
|
697
706
|
const isClassroomCreator = classroom && classroom.isCreator;
|
|
698
707
|
const tourCompleted = localStorage.getItem(`classroom-creator-tour-completed`);
|
|
699
708
|
const shouldPromptAvatarUpdate = !localStorage.getItem(`classroom-update-avatar-prompt-${username}`);
|
|
700
|
-
if (isClassroomCreator && !tourCompleted) {
|
|
709
|
+
if (isClassroomCreator && !tourCompleted && !run) {
|
|
701
710
|
setJoyrideState(prevState => ({
|
|
702
711
|
...prevState,
|
|
703
712
|
run: true
|
|
@@ -707,7 +716,7 @@ function Classroom({
|
|
|
707
716
|
if (shouldPromptAvatarUpdate && (isClassroomCreator && tourCompleted || isMember)) {
|
|
708
717
|
handleUpdateAvatarAndLearnLang();
|
|
709
718
|
}
|
|
710
|
-
}, [classroom, isMember, username]);
|
|
719
|
+
}, [classroom, isMember, username, run]);
|
|
711
720
|
const handleJoyrideCallback = data => {
|
|
712
721
|
const {
|
|
713
722
|
status,
|
|
@@ -320,13 +320,13 @@ function Progress({
|
|
|
320
320
|
return members.filter(member => {
|
|
321
321
|
if (memberId) {
|
|
322
322
|
return member.memberId === memberId;
|
|
323
|
-
} else if (selectedMembers && selectedMembers.length && reportType === "assignments" && assignedStudents) {
|
|
323
|
+
} else if (selectedMembers && selectedMembers.length && reportType === "assignments" && selectedAssignment && assignedStudents) {
|
|
324
324
|
const selectedMemberIds = selectedMembers.map(m => m.memberId);
|
|
325
325
|
return selectedMemberIds.includes(member.memberId) && (assignedStudents || []).includes(member.memberId);
|
|
326
326
|
} else if (selectedMembers && selectedMembers.length) {
|
|
327
327
|
const selectedMemberIds = selectedMembers.map(m => m.memberId);
|
|
328
328
|
return selectedMemberIds.includes(member.memberId);
|
|
329
|
-
} else if (reportType === "assignments" && assignedStudents) {
|
|
329
|
+
} else if (reportType === "assignments" && selectedAssignment && assignedStudents) {
|
|
330
330
|
return (assignedStudents || []).includes(member.memberId);
|
|
331
331
|
}
|
|
332
332
|
return true;
|