@nualang/nualang-ui-components 0.1.1233 → 0.1.1235
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/Assignments/AssignmentCard/AssignmentCard.js +5 -1
- package/dist/Assignments/AssignmentCardsList/AssignmentCardsList.js +4 -2
- package/dist/Assignments/AssignmentExerciseSelection/AssignmentExerciseSelection.js +1 -1
- package/dist/Assignments/AssignmentRoleplaySelection/AssignmentRoleplaySelection.js +1 -1
- package/dist/Dialogs/ExerciseMenu/Menus/CloseExercise/CloseExercise.js +2 -2
- package/dist/Dialogs/ExerciseMenu/Menus/CompletedExcercise/CompletedExcercise.js +2 -2
- package/dist/Dialogs/ExerciseMenu/Menus/InProgressExercise/InProgressExercise.js +2 -2
- package/dist/Exercises/Listener/Listener.js +9 -3
- package/dist/Exercises/Pronouncer/Pronouncer.js +9 -3
- package/dist/Exercises/Roleplay/Games/ActItOutGame/ActItOutGame.js +10 -3
- package/dist/Exercises/Roleplay/Games/ActItOutGameListening/ActItOutGameListening.js +10 -3
- package/dist/Exercises/Roleplay/Games/ActItOutGameListeningAndSpeaking/ActItOutGame.js +10 -3
- package/dist/Exercises/Roleplay/Games/ActItOutGameSpeaking/ActItOutGame.js +10 -3
- package/dist/Exercises/Roleplay/Games/FillInTheBlanksGame/FillInTheBlanksGame.js +10 -3
- package/dist/Exercises/Roleplay/Games/StoryGame/StoryGame.js +10 -3
- package/dist/Exercises/Roleplay/Roleplay.js +5 -1
- package/dist/Exercises/Translator/Translator.js +9 -3
- package/dist/Lists/Exercises/Exercises.js +6 -0
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +7 -0
- package/dist/Tables/Progress/Progress.js +19 -10
- package/dist/Tables/Progress/ProgressTable.js +3 -7
- package/dist/hooks/useExerciseState.js +6 -3
- package/package.json +2 -2
|
@@ -27,7 +27,8 @@ function AssignmentCard({
|
|
|
27
27
|
getCourses,
|
|
28
28
|
deleteAssignment,
|
|
29
29
|
handleEditAssignment,
|
|
30
|
-
lastClickedExerciseId
|
|
30
|
+
lastClickedExerciseId,
|
|
31
|
+
handleViewProgress
|
|
31
32
|
}) {
|
|
32
33
|
const [confirm] = (0, _useConfirm.default)(t);
|
|
33
34
|
const handleDeleteAssignment = async (classroomId, assignmentId) => {
|
|
@@ -242,6 +243,9 @@ function AssignmentCard({
|
|
|
242
243
|
marginTop: 2,
|
|
243
244
|
marginLeft: "15px"
|
|
244
245
|
},
|
|
246
|
+
onClick: () => handleViewProgress({
|
|
247
|
+
assignmentId: assignment?.assignmentId
|
|
248
|
+
}),
|
|
245
249
|
children: t("view_progress")
|
|
246
250
|
})]
|
|
247
251
|
})]
|
|
@@ -25,7 +25,8 @@ const AssignmentCardsList = ({
|
|
|
25
25
|
getRoleplays,
|
|
26
26
|
deleteAssignment,
|
|
27
27
|
handleEditAssignment,
|
|
28
|
-
refreshAssignments
|
|
28
|
+
refreshAssignments,
|
|
29
|
+
handleViewProgress
|
|
29
30
|
}) => {
|
|
30
31
|
const [lastClickedExerciseId, setLastClickedExerciseId] = (0, _react.useState)(null);
|
|
31
32
|
(0, _react.useEffect)(() => {
|
|
@@ -134,7 +135,8 @@ const AssignmentCardsList = ({
|
|
|
134
135
|
getRoleplays: getRoleplays,
|
|
135
136
|
deleteAssignment: deleteAssignment,
|
|
136
137
|
handleEditAssignment: handleEditAssignment,
|
|
137
|
-
lastClickedExerciseId: lastClickedExerciseId
|
|
138
|
+
lastClickedExerciseId: lastClickedExerciseId,
|
|
139
|
+
handleViewProgress: handleViewProgress
|
|
138
140
|
}, assignment.assignmentId))]
|
|
139
141
|
})
|
|
140
142
|
});
|
|
@@ -55,7 +55,7 @@ function Exercise({
|
|
|
55
55
|
};
|
|
56
56
|
localStorage.setItem("lastClickedExercise", JSON.stringify(lastClickedExercise));
|
|
57
57
|
const assignmentParam = encodeURIComponent(JSON.stringify(assignment));
|
|
58
|
-
navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}?exercise=${name}&
|
|
58
|
+
navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}?exercise=${name}&assignmentId=${assignment.assignmentId}`);
|
|
59
59
|
};
|
|
60
60
|
const handleToggleRoleplays = () => {
|
|
61
61
|
setRoleplaysOpen(!roleplaysOpen);
|
|
@@ -48,7 +48,7 @@ function Roleplay({
|
|
|
48
48
|
};
|
|
49
49
|
localStorage.setItem("lastClickedExercise", JSON.stringify(lastClickedExercise));
|
|
50
50
|
const assignmentParam = encodeURIComponent(JSON.stringify(assignment));
|
|
51
|
-
navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}/roleplays/${roleplay?.roleplayId}?game=${encodeURIComponent(exercise)}&
|
|
51
|
+
navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}/roleplays/${roleplay?.roleplayId}?game=${encodeURIComponent(exercise)}&assignmentId=${assignment.assignmentId}`);
|
|
52
52
|
};
|
|
53
53
|
const [open, setOpen] = (0, _react.useState)(lastClickedRoleplayId === roleplay.roleplayId && lastClickedAssignmentId === assignment.assignmentId);
|
|
54
54
|
const games = ["roleplay-story", "roleplay-fill-in-the-blanks", "roleplay-act-it-out", "roleplay-act-it-out-listening", "roleplay-act-it-out-speaking", "roleplay-act-it-out-listening-speaking"];
|
|
@@ -23,7 +23,7 @@ function CloseExerciseMenu({
|
|
|
23
23
|
}) {
|
|
24
24
|
const location = (0, _reactRouterDom.useLocation)();
|
|
25
25
|
const searchParams = new URLSearchParams(location.search);
|
|
26
|
-
const
|
|
26
|
+
const assignmentId = searchParams.get('assignmentId');
|
|
27
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExerciseMenu.default, {
|
|
28
28
|
open: open,
|
|
29
29
|
handleClose: close,
|
|
@@ -41,7 +41,7 @@ function CloseExerciseMenu({
|
|
|
41
41
|
color: "primary",
|
|
42
42
|
onClick: saveProgress,
|
|
43
43
|
disabled: isSpeaking
|
|
44
|
-
}, ...(
|
|
44
|
+
}, ...(assignmentId ? [{
|
|
45
45
|
dataCypress: "go_back_to_assignments",
|
|
46
46
|
text: t("go_back_to_assignments"),
|
|
47
47
|
variant: "",
|
|
@@ -23,7 +23,7 @@ function CompletedExerciseMenu({
|
|
|
23
23
|
}) {
|
|
24
24
|
const location = (0, _reactRouterDom.useLocation)();
|
|
25
25
|
const searchParams = new URLSearchParams(location.search);
|
|
26
|
-
const
|
|
26
|
+
const assignmentId = searchParams.get('assignmentId');
|
|
27
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExerciseMenu.default, {
|
|
28
28
|
open: open,
|
|
29
29
|
handleClose: close,
|
|
@@ -48,7 +48,7 @@ function CompletedExerciseMenu({
|
|
|
48
48
|
color: "primary",
|
|
49
49
|
onClick: viewReport,
|
|
50
50
|
disabled: disableViewReport
|
|
51
|
-
}, ...(
|
|
51
|
+
}, ...(assignmentId ? [{
|
|
52
52
|
dataCypress: "go_back_to_assignments",
|
|
53
53
|
text: t("go_back_to_assignments"),
|
|
54
54
|
variant: "",
|
|
@@ -20,7 +20,7 @@ function InProgressExercise({
|
|
|
20
20
|
}) {
|
|
21
21
|
const location = (0, _reactRouterDom.useLocation)();
|
|
22
22
|
const searchParams = new URLSearchParams(location.search);
|
|
23
|
-
const
|
|
23
|
+
const assignmentId = searchParams.get('assignmentId');
|
|
24
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExerciseMenu.default, {
|
|
25
25
|
open: open,
|
|
26
26
|
handleClose: close,
|
|
@@ -34,7 +34,7 @@ function InProgressExercise({
|
|
|
34
34
|
variant: "outlined",
|
|
35
35
|
color: "primary",
|
|
36
36
|
onClick: restartExercise
|
|
37
|
-
}, ...(
|
|
37
|
+
}, ...(assignmentId ? [{
|
|
38
38
|
text: t("go_back_to_assignments"),
|
|
39
39
|
variant: "",
|
|
40
40
|
color: "",
|
|
@@ -237,7 +237,8 @@ function Listener({
|
|
|
237
237
|
courseSettings,
|
|
238
238
|
parentClassroom,
|
|
239
239
|
isHeritageSpeaker = false,
|
|
240
|
-
classroomId
|
|
240
|
+
classroomId,
|
|
241
|
+
assignment
|
|
241
242
|
}) {
|
|
242
243
|
(0, _useExerciseDocumentTitle.default)({
|
|
243
244
|
exerciseTitle: "Listening",
|
|
@@ -276,7 +277,8 @@ function Listener({
|
|
|
276
277
|
incorrectSound,
|
|
277
278
|
disableShuffle,
|
|
278
279
|
toggleMuteSound,
|
|
279
|
-
isHeritageSpeaker
|
|
280
|
+
isHeritageSpeaker,
|
|
281
|
+
classroomId
|
|
280
282
|
});
|
|
281
283
|
const {
|
|
282
284
|
questions,
|
|
@@ -328,7 +330,8 @@ function Listener({
|
|
|
328
330
|
checkAnswer,
|
|
329
331
|
setCheckAnswer,
|
|
330
332
|
isWordBankAttemptChanged,
|
|
331
|
-
setIsWordBankAttemptChanged
|
|
333
|
+
setIsWordBankAttemptChanged,
|
|
334
|
+
setIsAssignmentExercise
|
|
332
335
|
} = exerciseState;
|
|
333
336
|
const {
|
|
334
337
|
handleSelectInAnswerBox,
|
|
@@ -468,6 +471,9 @@ function Listener({
|
|
|
468
471
|
setCheckAnswer(false);
|
|
469
472
|
setIsWordBankAttemptChanged(true);
|
|
470
473
|
}, [listeningWords]);
|
|
474
|
+
(0, _react.useEffect)(() => {
|
|
475
|
+
assignment ? setIsAssignmentExercise(true) : setIsAssignmentExercise(false);
|
|
476
|
+
}, [assignment]);
|
|
471
477
|
(0, _react.useEffect)(() => {
|
|
472
478
|
if (open && !run && !localStorage.getItem(`listening-exercise-tour-completed`)) {
|
|
473
479
|
setJoyrideState(prevState => ({
|
|
@@ -165,7 +165,8 @@ function Pronouncer({
|
|
|
165
165
|
languageTag,
|
|
166
166
|
trackRecommendedEvent,
|
|
167
167
|
parentClassroom,
|
|
168
|
-
classroomId
|
|
168
|
+
classroomId,
|
|
169
|
+
assignment
|
|
169
170
|
}) {
|
|
170
171
|
(0, _useExerciseDocumentTitle.default)({
|
|
171
172
|
exerciseTitle: "Pronunciation",
|
|
@@ -267,7 +268,8 @@ function Pronouncer({
|
|
|
267
268
|
indicateEndStream,
|
|
268
269
|
disableShuffle,
|
|
269
270
|
toggleMuteSound,
|
|
270
|
-
audioBlob
|
|
271
|
+
audioBlob,
|
|
272
|
+
classroomId
|
|
271
273
|
});
|
|
272
274
|
const {
|
|
273
275
|
questions,
|
|
@@ -314,13 +316,17 @@ function Pronouncer({
|
|
|
314
316
|
handlePronunciationTourFinished,
|
|
315
317
|
handleTryAgain,
|
|
316
318
|
checked,
|
|
317
|
-
setChecked
|
|
319
|
+
setChecked,
|
|
320
|
+
setIsAssignmentExercise
|
|
318
321
|
} = exerciseState;
|
|
319
322
|
(0, _react.useEffect)(() => {
|
|
320
323
|
if (currentPhrase?.phrase) {
|
|
321
324
|
setCurrentPhraseText(currentPhrase.phrase);
|
|
322
325
|
}
|
|
323
326
|
}, [currentPhrase]);
|
|
327
|
+
(0, _react.useEffect)(() => {
|
|
328
|
+
assignment ? setIsAssignmentExercise(true) : setIsAssignmentExercise(false);
|
|
329
|
+
}, [assignment]);
|
|
324
330
|
const unattemptedQuestionTotal = questions.filter(q => !q.questionAttempted).length;
|
|
325
331
|
const joyrideSteps = [{
|
|
326
332
|
content: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
@@ -195,7 +195,9 @@ function RoleplayGame({
|
|
|
195
195
|
translationEnabled,
|
|
196
196
|
parentClassroom,
|
|
197
197
|
isHeritageSpeaker = false,
|
|
198
|
-
goBackToAssignment
|
|
198
|
+
goBackToAssignment,
|
|
199
|
+
assignment,
|
|
200
|
+
classroomId
|
|
199
201
|
}) {
|
|
200
202
|
(0, _useExerciseDocumentTitle.default)({
|
|
201
203
|
exerciseTitle: "Act it out",
|
|
@@ -248,7 +250,8 @@ function RoleplayGame({
|
|
|
248
250
|
clearQueue,
|
|
249
251
|
stopAudio,
|
|
250
252
|
languageInformation,
|
|
251
|
-
isHeritageSpeaker
|
|
253
|
+
isHeritageSpeaker,
|
|
254
|
+
classroomId
|
|
252
255
|
});
|
|
253
256
|
const {
|
|
254
257
|
muteSound,
|
|
@@ -299,13 +302,17 @@ function RoleplayGame({
|
|
|
299
302
|
isSpeaking,
|
|
300
303
|
isSpeakingTextContainer,
|
|
301
304
|
actorHasBeenSelected,
|
|
302
|
-
setActorHasBeenSelected
|
|
305
|
+
setActorHasBeenSelected,
|
|
306
|
+
setIsAssignmentExercise
|
|
303
307
|
} = exerciseState;
|
|
304
308
|
(0, _react.useEffect)(() => {
|
|
305
309
|
if (actorHasBeenSelected) {
|
|
306
310
|
startRoleplay();
|
|
307
311
|
}
|
|
308
312
|
}, [actorHasBeenSelected]);
|
|
313
|
+
(0, _react.useEffect)(() => {
|
|
314
|
+
assignment ? setIsAssignmentExercise(true) : setIsAssignmentExercise(false);
|
|
315
|
+
}, [assignment]);
|
|
309
316
|
const isRoleplayScriptLoaded = roleplay && roleplay.script;
|
|
310
317
|
(0, _react.useEffect)(() => {
|
|
311
318
|
if (isRoleplayScriptLoaded) {
|
|
@@ -197,7 +197,9 @@ function RoleplayGame({
|
|
|
197
197
|
languageInformation,
|
|
198
198
|
translationEnabled,
|
|
199
199
|
parentClassroom,
|
|
200
|
-
goBackToAssignment
|
|
200
|
+
goBackToAssignment,
|
|
201
|
+
assignment,
|
|
202
|
+
classroomId
|
|
201
203
|
}) {
|
|
202
204
|
(0, _useExerciseDocumentTitle.default)({
|
|
203
205
|
exerciseTitle: "Act it out listening",
|
|
@@ -249,7 +251,8 @@ function RoleplayGame({
|
|
|
249
251
|
toggleMuteSound,
|
|
250
252
|
clearQueue,
|
|
251
253
|
stopAudio,
|
|
252
|
-
languageInformation
|
|
254
|
+
languageInformation,
|
|
255
|
+
classroomId
|
|
253
256
|
});
|
|
254
257
|
const {
|
|
255
258
|
muteSound,
|
|
@@ -300,13 +303,17 @@ function RoleplayGame({
|
|
|
300
303
|
isSpeaking,
|
|
301
304
|
isSpeakingTextContainer,
|
|
302
305
|
actorHasBeenSelected,
|
|
303
|
-
setActorHasBeenSelected
|
|
306
|
+
setActorHasBeenSelected,
|
|
307
|
+
setIsAssignmentExercise
|
|
304
308
|
} = exerciseState;
|
|
305
309
|
(0, _react.useEffect)(() => {
|
|
306
310
|
if (actorHasBeenSelected) {
|
|
307
311
|
startRoleplay();
|
|
308
312
|
}
|
|
309
313
|
}, [actorHasBeenSelected]);
|
|
314
|
+
(0, _react.useEffect)(() => {
|
|
315
|
+
assignment ? setIsAssignmentExercise(true) : setIsAssignmentExercise(false);
|
|
316
|
+
}, [assignment]);
|
|
310
317
|
const isRoleplayScriptLoaded = roleplay && roleplay.script;
|
|
311
318
|
(0, _react.useEffect)(() => {
|
|
312
319
|
if (isRoleplayScriptLoaded) {
|
|
@@ -293,7 +293,9 @@ function RoleplayGame({
|
|
|
293
293
|
translationEnabled,
|
|
294
294
|
trackRecommendedEvent,
|
|
295
295
|
parentClassroom,
|
|
296
|
-
goBackToAssignment
|
|
296
|
+
goBackToAssignment,
|
|
297
|
+
assignment,
|
|
298
|
+
classroomId
|
|
297
299
|
}) {
|
|
298
300
|
(0, _useExerciseDocumentTitle.default)({
|
|
299
301
|
exerciseTitle: "Act it out listening and speaking",
|
|
@@ -369,7 +371,8 @@ function RoleplayGame({
|
|
|
369
371
|
uploadAudioAttempt,
|
|
370
372
|
clearQueue,
|
|
371
373
|
stopAudio,
|
|
372
|
-
languageInformation
|
|
374
|
+
languageInformation,
|
|
375
|
+
classroomId
|
|
373
376
|
});
|
|
374
377
|
const {
|
|
375
378
|
muteSound,
|
|
@@ -431,7 +434,8 @@ function RoleplayGame({
|
|
|
431
434
|
isSpeaking,
|
|
432
435
|
isSpeakingTextContainer,
|
|
433
436
|
actorHasBeenSelected,
|
|
434
|
-
setActorHasBeenSelected
|
|
437
|
+
setActorHasBeenSelected,
|
|
438
|
+
setIsAssignmentExercise
|
|
435
439
|
} = exerciseState;
|
|
436
440
|
const handleMic = expectedTranscript => {
|
|
437
441
|
const speechContexts = expectedTranscript ? [{
|
|
@@ -453,6 +457,9 @@ function RoleplayGame({
|
|
|
453
457
|
}
|
|
454
458
|
return () => clearTimeout(timer);
|
|
455
459
|
}, [recognizing, interimTranscript, finalTranscript]);
|
|
460
|
+
(0, _react.useEffect)(() => {
|
|
461
|
+
assignment ? setIsAssignmentExercise(true) : setIsAssignmentExercise(false);
|
|
462
|
+
}, [assignment]);
|
|
456
463
|
const getRandomNuala = () => {
|
|
457
464
|
let finished = false;
|
|
458
465
|
while (!finished) {
|
|
@@ -289,7 +289,9 @@ function RoleplayGame({
|
|
|
289
289
|
trackRecommendedEvent,
|
|
290
290
|
parentClassroom,
|
|
291
291
|
isHeritageSpeaker,
|
|
292
|
-
goBackToAssignment
|
|
292
|
+
goBackToAssignment,
|
|
293
|
+
assignment,
|
|
294
|
+
classroomId
|
|
293
295
|
}) {
|
|
294
296
|
(0, _useExerciseDocumentTitle.default)({
|
|
295
297
|
exerciseTitle: "Act it out speaking",
|
|
@@ -367,7 +369,8 @@ function RoleplayGame({
|
|
|
367
369
|
clearQueue,
|
|
368
370
|
stopAudio,
|
|
369
371
|
languageInformation,
|
|
370
|
-
isHeritageSpeaker
|
|
372
|
+
isHeritageSpeaker,
|
|
373
|
+
classroomId
|
|
371
374
|
});
|
|
372
375
|
const {
|
|
373
376
|
muteSound,
|
|
@@ -429,7 +432,8 @@ function RoleplayGame({
|
|
|
429
432
|
isSpeaking,
|
|
430
433
|
isSpeakingTextContainer,
|
|
431
434
|
actorHasBeenSelected,
|
|
432
|
-
setActorHasBeenSelected
|
|
435
|
+
setActorHasBeenSelected,
|
|
436
|
+
setIsAssignmentExercise
|
|
433
437
|
} = exerciseState;
|
|
434
438
|
const handleMic = expectedTranscript => {
|
|
435
439
|
const speechContexts = expectedTranscript ? [{
|
|
@@ -452,6 +456,9 @@ function RoleplayGame({
|
|
|
452
456
|
}
|
|
453
457
|
return () => clearTimeout(timer);
|
|
454
458
|
}, [recognizing, interimTranscript, finalTranscript]);
|
|
459
|
+
(0, _react.useEffect)(() => {
|
|
460
|
+
assignment ? setIsAssignmentExercise(true) : setIsAssignmentExercise(false);
|
|
461
|
+
}, [assignment]);
|
|
455
462
|
const getRandomNuala = () => {
|
|
456
463
|
let finished = false;
|
|
457
464
|
while (!finished) {
|
|
@@ -70,7 +70,9 @@ function RoleplayGame({
|
|
|
70
70
|
translationEnabled,
|
|
71
71
|
parentClassroom,
|
|
72
72
|
isHeritageSpeaker = false,
|
|
73
|
-
goBackToAssignment
|
|
73
|
+
goBackToAssignment,
|
|
74
|
+
assignment,
|
|
75
|
+
classroomId
|
|
74
76
|
}) {
|
|
75
77
|
(0, _useExerciseDocumentTitle.default)({
|
|
76
78
|
exerciseTitle: "Fill in the blanks",
|
|
@@ -124,7 +126,8 @@ function RoleplayGame({
|
|
|
124
126
|
clearQueue,
|
|
125
127
|
stopAudio,
|
|
126
128
|
languageInformation,
|
|
127
|
-
isHeritageSpeaker
|
|
129
|
+
isHeritageSpeaker,
|
|
130
|
+
classroomId
|
|
128
131
|
});
|
|
129
132
|
const {
|
|
130
133
|
muteSound,
|
|
@@ -169,7 +172,8 @@ function RoleplayGame({
|
|
|
169
172
|
speak,
|
|
170
173
|
stopSpeaking,
|
|
171
174
|
isSpeaking,
|
|
172
|
-
isSpeakingTextContainer
|
|
175
|
+
isSpeakingTextContainer,
|
|
176
|
+
setIsAssignmentExercise
|
|
173
177
|
} = exerciseState;
|
|
174
178
|
const [messagesSet, setMessagesSet] = (0, _react.useState)(false);
|
|
175
179
|
const handleContinueExercise = () => {
|
|
@@ -181,6 +185,9 @@ function RoleplayGame({
|
|
|
181
185
|
startRoleplay();
|
|
182
186
|
}
|
|
183
187
|
}, [currentMessages.length, messagesSet]);
|
|
188
|
+
(0, _react.useEffect)(() => {
|
|
189
|
+
assignment ? setIsAssignmentExercise(true) : setIsAssignmentExercise(false);
|
|
190
|
+
}, [assignment]);
|
|
184
191
|
const isRoleplayScriptLoaded = roleplay && roleplay.script;
|
|
185
192
|
(0, _react.useEffect)(() => {
|
|
186
193
|
if (isRoleplayScriptLoaded) {
|
|
@@ -63,7 +63,9 @@ function RoleplayGame({
|
|
|
63
63
|
translationEnabled,
|
|
64
64
|
parentClassroom,
|
|
65
65
|
isHeritageSpeaker,
|
|
66
|
-
goBackToAssignment
|
|
66
|
+
goBackToAssignment,
|
|
67
|
+
assignment,
|
|
68
|
+
classroomId
|
|
67
69
|
}) {
|
|
68
70
|
(0, _useExerciseDocumentTitle.default)({
|
|
69
71
|
exerciseTitle: "Story",
|
|
@@ -116,7 +118,8 @@ function RoleplayGame({
|
|
|
116
118
|
clearQueue,
|
|
117
119
|
stopAudio,
|
|
118
120
|
languageInformation,
|
|
119
|
-
isHeritageSpeaker
|
|
121
|
+
isHeritageSpeaker,
|
|
122
|
+
classroomId
|
|
120
123
|
});
|
|
121
124
|
const {
|
|
122
125
|
muteSound,
|
|
@@ -161,7 +164,8 @@ function RoleplayGame({
|
|
|
161
164
|
speak,
|
|
162
165
|
stopSpeaking,
|
|
163
166
|
isSpeaking,
|
|
164
|
-
isSpeakingTextContainer
|
|
167
|
+
isSpeakingTextContainer,
|
|
168
|
+
setIsAssignmentExercise
|
|
165
169
|
} = exerciseState;
|
|
166
170
|
const [messagesSet, setMessagesSet] = (0, _react.useState)(false);
|
|
167
171
|
const btnRef = (0, _react.useRef)();
|
|
@@ -174,6 +178,9 @@ function RoleplayGame({
|
|
|
174
178
|
startRoleplay();
|
|
175
179
|
}
|
|
176
180
|
}, [currentMessages.length, game, messagesSet]);
|
|
181
|
+
(0, _react.useEffect)(() => {
|
|
182
|
+
assignment ? setIsAssignmentExercise(true) : setIsAssignmentExercise(false);
|
|
183
|
+
}, [assignment]);
|
|
177
184
|
const isRoleplayScriptLoaded = roleplay && roleplay.script;
|
|
178
185
|
(0, _react.useEffect)(() => {
|
|
179
186
|
if (isRoleplayScriptLoaded) {
|
|
@@ -76,7 +76,9 @@ function Roleplay({
|
|
|
76
76
|
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
77
77
|
const location = (0, _reactRouterDom.useLocation)();
|
|
78
78
|
const searchParams = (0, _utils.searchStringToObj)(location.search);
|
|
79
|
+
const searchAssignmentParams = new URLSearchParams(location.search);
|
|
79
80
|
const game = searchParams.game;
|
|
81
|
+
const assignmentId = searchAssignmentParams.get('assignmentId');
|
|
80
82
|
const params = (0, _reactRouterDom.useParams)();
|
|
81
83
|
const {
|
|
82
84
|
classroomId
|
|
@@ -365,7 +367,9 @@ function Roleplay({
|
|
|
365
367
|
trackRecommendedEvent: trackRecommendedEvent,
|
|
366
368
|
parentClassroom: parentClassroom,
|
|
367
369
|
isHeritageSpeaker: isHeritageSpeaker,
|
|
368
|
-
goBackToAssignment: goBackToAssignment
|
|
370
|
+
goBackToAssignment: goBackToAssignment,
|
|
371
|
+
assignment: assignmentId,
|
|
372
|
+
classroomId: classroomId
|
|
369
373
|
}, `roleplay-game-${RoleplayGame.gameId}`);
|
|
370
374
|
}
|
|
371
375
|
return null;
|
|
@@ -245,7 +245,8 @@ function Translator({
|
|
|
245
245
|
isKeyboardHiddenTranslation,
|
|
246
246
|
parentClassroom,
|
|
247
247
|
isHeritageSpeaker,
|
|
248
|
-
classroomId
|
|
248
|
+
classroomId,
|
|
249
|
+
assignment
|
|
249
250
|
}) {
|
|
250
251
|
(0, _useExerciseDocumentTitle.default)({
|
|
251
252
|
exerciseTitle: "Translation",
|
|
@@ -285,7 +286,8 @@ function Translator({
|
|
|
285
286
|
disableShuffle,
|
|
286
287
|
toggleMuteSound,
|
|
287
288
|
isKeyboardHiddenTranslation,
|
|
288
|
-
isHeritageSpeaker
|
|
289
|
+
isHeritageSpeaker,
|
|
290
|
+
classroomId
|
|
289
291
|
});
|
|
290
292
|
const {
|
|
291
293
|
questions,
|
|
@@ -335,7 +337,8 @@ function Translator({
|
|
|
335
337
|
checkAnswer,
|
|
336
338
|
setCheckAnswer,
|
|
337
339
|
isWordBankAttemptChanged,
|
|
338
|
-
setIsWordBankAttemptChanged
|
|
340
|
+
setIsWordBankAttemptChanged,
|
|
341
|
+
setIsAssignmentExercise
|
|
339
342
|
} = exerciseState;
|
|
340
343
|
const unattemptedQuestionTotal = questions.filter(q => !q.questionAttempted).length;
|
|
341
344
|
const {
|
|
@@ -459,6 +462,9 @@ function Translator({
|
|
|
459
462
|
setIsWordBankAttemptChanged(true);
|
|
460
463
|
setIncomplete(false);
|
|
461
464
|
}, [translationWords]);
|
|
465
|
+
(0, _react.useEffect)(() => {
|
|
466
|
+
assignment ? setIsAssignmentExercise(true) : setIsAssignmentExercise(false);
|
|
467
|
+
}, [assignment]);
|
|
462
468
|
(0, _react.useEffect)(() => {
|
|
463
469
|
checkAnswer && checkCompletionAndNotify();
|
|
464
470
|
}, [checkAnswer]);
|
|
@@ -882,6 +882,7 @@ function Exercises(props) {
|
|
|
882
882
|
const location = (0, _reactRouterDom.useLocation)();
|
|
883
883
|
const searchParams = (0, _utils.searchStringToObj)(location.search);
|
|
884
884
|
const exercise = searchParams.exercise;
|
|
885
|
+
const assignmentId = searchParams.assignmentId;
|
|
885
886
|
const [showPronunciationOverflowMenu, setShowPronunciationOverflowMenu] = (0, _react.useState)(null);
|
|
886
887
|
const [showTranslationOverflowMenu, setShowTranslationOverflowMenu] = (0, _react.useState)(null);
|
|
887
888
|
const [showListeningOverflowMenu, setShowListeningOverflowMenu] = (0, _react.useState)(null);
|
|
@@ -1626,6 +1627,8 @@ function Exercises(props) {
|
|
|
1626
1627
|
moveRoleplay: moveRoleplay,
|
|
1627
1628
|
onDropRoleplay: onDropRoleplay,
|
|
1628
1629
|
handleUpdateRoleplay: handleUpdateRoleplay,
|
|
1630
|
+
classroomId: classroomId,
|
|
1631
|
+
assignment: assignmentId,
|
|
1629
1632
|
...props
|
|
1630
1633
|
}, roleplay.roleplayId)), isCreator ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
1631
1634
|
"data-cy": "add-roleplay-exercise",
|
|
@@ -1794,6 +1797,7 @@ function Exercises(props) {
|
|
|
1794
1797
|
parentClassroom: parentClassroom,
|
|
1795
1798
|
isHeritageSpeaker: isHeritageSpeaker,
|
|
1796
1799
|
classroomId: classroomId,
|
|
1800
|
+
assignment: assignmentId,
|
|
1797
1801
|
...pronunciationProgress
|
|
1798
1802
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Translator.default, {
|
|
1799
1803
|
t: t,
|
|
@@ -1833,6 +1837,7 @@ function Exercises(props) {
|
|
|
1833
1837
|
parentClassroom: parentClassroom,
|
|
1834
1838
|
isHeritageSpeaker: isHeritageSpeaker,
|
|
1835
1839
|
classroomId: classroomId,
|
|
1840
|
+
assignment: assignmentId,
|
|
1836
1841
|
...translationProgress
|
|
1837
1842
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Listener.default, {
|
|
1838
1843
|
t: t,
|
|
@@ -1872,6 +1877,7 @@ function Exercises(props) {
|
|
|
1872
1877
|
parentClassroom: parentClassroom,
|
|
1873
1878
|
isHeritageSpeaker: isHeritageSpeaker,
|
|
1874
1879
|
classroomId: classroomId,
|
|
1880
|
+
assignment: assignmentId,
|
|
1875
1881
|
...listeningProgress
|
|
1876
1882
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectClassroom.default, {
|
|
1877
1883
|
t: t,
|
|
@@ -457,6 +457,12 @@ function Classroom({
|
|
|
457
457
|
handleOpenCreatorNotSubscribedUpgradeModal();
|
|
458
458
|
}
|
|
459
459
|
}, [creatorSubscription]);
|
|
460
|
+
const handleViewProgress = ({
|
|
461
|
+
assignmentId
|
|
462
|
+
}) => {
|
|
463
|
+
setOverwriteValue(tabs.findIndex(tab => tab.id === "Progress"));
|
|
464
|
+
navigate(`?assignmentId=${assignmentId}&reportType=assignments#Progress`);
|
|
465
|
+
};
|
|
460
466
|
(0, _react.useEffect)(() => {
|
|
461
467
|
const handleHashChange = () => {
|
|
462
468
|
if (window.location.hash === "#Settings" && tabs) {
|
|
@@ -874,6 +880,7 @@ function Classroom({
|
|
|
874
880
|
TabContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
875
881
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCardsList.default, {
|
|
876
882
|
t: t,
|
|
883
|
+
handleViewProgress: handleViewProgress,
|
|
877
884
|
isCreator: isCreator,
|
|
878
885
|
assignments: assignments,
|
|
879
886
|
courses: courses,
|
|
@@ -132,7 +132,7 @@ const TableToolbar = ({
|
|
|
132
132
|
mr: 1,
|
|
133
133
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectMembers.default, {
|
|
134
134
|
t: t,
|
|
135
|
-
members: members,
|
|
135
|
+
members: members.sort((a, b) => (a.username || "").localeCompare(b.username || "")),
|
|
136
136
|
selectedMembers: selectedMembers,
|
|
137
137
|
setSelectedMembers: setSelectedMembers
|
|
138
138
|
})
|
|
@@ -334,7 +334,23 @@ function Progress({
|
|
|
334
334
|
}
|
|
335
335
|
}, [selectedCourse, selectedSection, selectedTopic, selectedRoleplay, selectedAssignment, reportType]); // If selections change, update the url to reflect those changes
|
|
336
336
|
|
|
337
|
-
|
|
337
|
+
const [selectedMembers, setSelectedMembers] = (0, _react.useState)([]);
|
|
338
|
+
const classroomMembers = (0, _react.useMemo)(() => {
|
|
339
|
+
return members.filter(member => {
|
|
340
|
+
if (memberId) {
|
|
341
|
+
return member.memberId === memberId;
|
|
342
|
+
} else if (selectedMembers && selectedMembers.length && reportType === "assignments" && selectedAssignment?.assignedStudents) {
|
|
343
|
+
const selectedMemberIds = selectedMembers.map(m => m.memberId);
|
|
344
|
+
return selectedMemberIds.includes(member.memberId) && selectedAssignment?.assignedStudents.includes(member.memberId);
|
|
345
|
+
} else if (selectedMembers && selectedMembers.length) {
|
|
346
|
+
const selectedMemberIds = selectedMembers.map(m => m.memberId);
|
|
347
|
+
return selectedMemberIds.includes(member.memberId);
|
|
348
|
+
} else if (reportType === "assignments" && selectedAssignment?.assignedStudents) {
|
|
349
|
+
return selectedAssignment?.assignedStudents.includes(member.memberId);
|
|
350
|
+
}
|
|
351
|
+
return true;
|
|
352
|
+
});
|
|
353
|
+
}, [members, memberId, selectedMembers, reportType, selectedAssignment]);
|
|
338
354
|
let currentView = "all_courses";
|
|
339
355
|
if (reportType === "assignments" && selectedTopic && selectedRoleplay) {
|
|
340
356
|
currentView = "assignment-roleplay";
|
|
@@ -351,13 +367,6 @@ function Progress({
|
|
|
351
367
|
} else if (selectedCourse) {
|
|
352
368
|
currentView = "course";
|
|
353
369
|
}
|
|
354
|
-
const [selectedMembers, setSelectedMembers] = (0, _react.useState)([]);
|
|
355
|
-
if (memberId) {
|
|
356
|
-
classroomMembers = classroomMembers.filter(m => m.memberId === memberId);
|
|
357
|
-
} else if (selectedMembers && selectedMembers.length) {
|
|
358
|
-
const selectedMemberIds = selectedMembers.map(m => m.memberId);
|
|
359
|
-
classroomMembers = classroomMembers.filter(m => selectedMemberIds.includes(m.memberId));
|
|
360
|
-
}
|
|
361
370
|
async function generateOverview(filter) {
|
|
362
371
|
const XLSX = require("xlsx");
|
|
363
372
|
let workbook = XLSX.utils.book_new();
|
|
@@ -441,7 +450,7 @@ function Progress({
|
|
|
441
450
|
})]
|
|
442
451
|
});
|
|
443
452
|
}
|
|
444
|
-
if (
|
|
453
|
+
if (members.length === 0) {
|
|
445
454
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
446
455
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
447
456
|
variant: "h6",
|
|
@@ -791,6 +791,7 @@ function ProgressTable({
|
|
|
791
791
|
classroomId,
|
|
792
792
|
courses = [],
|
|
793
793
|
members = [],
|
|
794
|
+
classroomMembers2 = [],
|
|
794
795
|
fetchMemberCourseCompletions = () => {},
|
|
795
796
|
currentView,
|
|
796
797
|
filter,
|
|
@@ -811,11 +812,11 @@ function ProgressTable({
|
|
|
811
812
|
featureFlags,
|
|
812
813
|
reportType
|
|
813
814
|
}) {
|
|
814
|
-
const selectedAssignmentTopics = selectedAssignment?.exercises?.map(e => e.courseSectionTopicId);
|
|
815
|
+
const selectedAssignmentTopics = (selectedAssignment?.exercises || [])?.map(e => e.courseSectionTopicId);
|
|
815
816
|
const assignmentTopics = courses.flatMap(c => c.sections.flatMap(s => s.topics)).filter(t => selectedAssignmentTopics?.includes(`${t.courseSectionId}|${t.topicId}`));
|
|
816
817
|
const topics = reportType === "exercises" && selectedCourse && selectedSection ? selectedCourse.sections[selectedCourse.sections.findIndex(s => s.sectionId === selectedSection.sectionId)].topics : [];
|
|
817
818
|
const tableTopics = reportType === "assignments" ? assignmentTopics : topics;
|
|
818
|
-
const assignmentExercises = reportType === "assignments" && selectedTopic ? selectedAssignment?.exercises.filter(e => e.courseSectionTopicId === `${selectedTopic.courseSectionId}|${selectedTopic.topicId}`) : [];
|
|
819
|
+
const assignmentExercises = reportType === "assignments" && selectedTopic ? (selectedAssignment?.exercises || []).filter(e => e.courseSectionTopicId === `${selectedTopic.courseSectionId}|${selectedTopic.topicId}`) : [];
|
|
819
820
|
const exercises = ["translation", "listening", "pronunciation"];
|
|
820
821
|
const tableExercises = assignmentExercises && assignmentExercises.length ? exercises.filter(e => assignmentExercises.some(ae => ae.name === e)) : exercises;
|
|
821
822
|
const tableRoleplays = assignmentExercises && assignmentExercises.length ? roleplays.filter(r => assignmentExercises.some(ae => ae.roleplayId === r.roleplayId)) : roleplays;
|
|
@@ -829,11 +830,6 @@ function ProgressTable({
|
|
|
829
830
|
(0, _react.useEffect)(() => {
|
|
830
831
|
setMembersState(stableSort(members, sortColumn, getComparator(sortDirection))); // sort alphabetically by default
|
|
831
832
|
}, [filter, members]);
|
|
832
|
-
(0, _react.useEffect)(() => {
|
|
833
|
-
if (reportType === "assignments" && selectedAssignment?.assignedStudents) {
|
|
834
|
-
setMembersState(stableSort(members.filter(member => selectedAssignment?.assignedStudents.includes(member.memberId)), sortColumn, getComparator(sortDirection)));
|
|
835
|
-
}
|
|
836
|
-
}, [reportType, selectedAssignment, members]);
|
|
837
833
|
function descendingComparator(a, b, property) {
|
|
838
834
|
try {
|
|
839
835
|
let a1;
|
|
@@ -67,7 +67,8 @@ function useExerciseState({
|
|
|
67
67
|
isLiveGame = false,
|
|
68
68
|
isCreator,
|
|
69
69
|
isKeyboardHiddenTranslation,
|
|
70
|
-
isHeritageSpeaker = false
|
|
70
|
+
isHeritageSpeaker = false,
|
|
71
|
+
classroomId
|
|
71
72
|
}) {
|
|
72
73
|
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
73
74
|
const [questions, setQuestions] = (0, _react.useState)([]);
|
|
@@ -120,6 +121,7 @@ function useExerciseState({
|
|
|
120
121
|
const [checkAnswer, setCheckAnswer] = (0, _react.useState)(false);
|
|
121
122
|
const [isWordBankAttemptChanged, setIsWordBankAttemptChanged] = (0, _react.useState)(false);
|
|
122
123
|
const [isKeyboardHidden, setIsKeyboardHidden] = (0, _react.useState)(false);
|
|
124
|
+
const [isAssignmentExercise, setIsAssignmentExercise] = (0, _react.useState)(false);
|
|
123
125
|
(0, _react.useEffect)(() => {
|
|
124
126
|
if (isLiveGame && existingMessages && existingMessages.length > 0) {
|
|
125
127
|
setRoleplayMessages(existingMessages);
|
|
@@ -1568,7 +1570,7 @@ function useExerciseState({
|
|
|
1568
1570
|
};
|
|
1569
1571
|
const handleCloseClicked = () => {
|
|
1570
1572
|
if (answerAttempts.length === 0 && botMessages.length === 0 && !roleplayHasStarted) {
|
|
1571
|
-
handleClose();
|
|
1573
|
+
isAssignmentExercise ? navigate(`/classrooms/${classroomId}#Assignments`) : handleClose();
|
|
1572
1574
|
} else {
|
|
1573
1575
|
openCloseModal();
|
|
1574
1576
|
}
|
|
@@ -1988,6 +1990,7 @@ function useExerciseState({
|
|
|
1988
1990
|
isWordBankAttemptChanged,
|
|
1989
1991
|
setIsWordBankAttemptChanged,
|
|
1990
1992
|
isKeyboardHidden,
|
|
1991
|
-
setWordOptions
|
|
1993
|
+
setWordOptions,
|
|
1994
|
+
setIsAssignmentExercise
|
|
1992
1995
|
};
|
|
1993
1996
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nualang/nualang-ui-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1235",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@mui/material": "^5.15.20",
|
|
21
21
|
"@mui/system": "^5.15.20",
|
|
22
22
|
"@mui/x-date-pickers": "^7.7.0",
|
|
23
|
-
"@nualang/nualang-api-and-queries": "^1.
|
|
23
|
+
"@nualang/nualang-api-and-queries": "^1.1.1",
|
|
24
24
|
"@storybook/theming": "^8.1.10",
|
|
25
25
|
"@stripe/react-stripe-js": "^2.1.1",
|
|
26
26
|
"@stripe/stripe-js": "^1.54.2",
|