@nualang/nualang-ui-components 0.1.1260 → 0.1.1262
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/AssignmentExerciseSelection/AssignmentExerciseSelection.js +1 -0
- package/dist/Assignments/AssignmentRoleplaySelection/AssignmentRoleplaySelection.js +10 -5
- package/dist/Assignments/CreateAssignmentDialog/CreateAssignmentDialog.js +150 -124
- package/dist/Cards/Course/Course.js +1 -1
- package/dist/Editors/Bot/Editor/Editor.js +0 -10
- package/dist/Exercises/Bot/Bot.js +10 -2
- package/dist/Forms/CreateBot/CreateBot.js +2 -1
- package/dist/Forms/CreateBot/Steps/BotSettings/BotSettings.js +34 -2
- package/dist/Forms/CreateBot/Steps/Confirmation/Confirmation.js +34 -3
- package/dist/Forms/CreateCourse/Steps/CourseSettings/CourseSettings.js +37 -36
- package/dist/Forms/UpdateBot/UpdateBot.js +8 -4
- package/dist/Forms/UpdateCourse/UpdateCourse.js +6 -3
- package/dist/Screens/Courses/Courses.js +6 -3
- package/dist/hooks/useExerciseState.js +16 -3
- package/package.json +1 -1
|
@@ -616,6 +616,7 @@ function Topic({
|
|
|
616
616
|
}), useCase === "assignment-select" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
617
617
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
618
618
|
checked: selectedCount === totalCount,
|
|
619
|
+
indeterminate: selectedCount > 0 && selectedCount < totalCount,
|
|
619
620
|
onClick: event => {
|
|
620
621
|
event.stopPropagation();
|
|
621
622
|
},
|
|
@@ -91,9 +91,7 @@ function Roleplay({
|
|
|
91
91
|
assignment,
|
|
92
92
|
memberCourseCompletions,
|
|
93
93
|
topicProgress,
|
|
94
|
-
|
|
95
|
-
lastClickedExerciseId,
|
|
96
|
-
topics
|
|
94
|
+
lastClickedExerciseId
|
|
97
95
|
}) {
|
|
98
96
|
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
99
97
|
const params = (0, _reactRouterDom.useParams)();
|
|
@@ -101,8 +99,9 @@ function Roleplay({
|
|
|
101
99
|
classroomId
|
|
102
100
|
} = params;
|
|
103
101
|
const [selectedGames, setSelectedGames] = (0, _react.useState)([]);
|
|
102
|
+
const [indeterminate, setIndeterminate] = (0, _react.useState)(false);
|
|
104
103
|
const [courseId, sectionId, topicId] = courseSectionTopicId ? courseSectionTopicId.split("|") : "";
|
|
105
|
-
const [
|
|
104
|
+
const [lastClickedAssignmentId, lastClickedRoleplayId] = lastClickedExerciseId?.split("|") || [];
|
|
106
105
|
const addSearchParams = exercise => {
|
|
107
106
|
if (!classroomId || !courseId || !sectionId || !topicId || !roleplay?.roleplayId) {
|
|
108
107
|
console.error("Missing required parameters for navigation");
|
|
@@ -118,8 +117,9 @@ function Roleplay({
|
|
|
118
117
|
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"];
|
|
119
118
|
const [isSelectAllChecked, setIsSelectAllChecked] = (0, _react.useState)(false);
|
|
120
119
|
(0, _react.useEffect)(() => {
|
|
121
|
-
const count = selectedExercises?.filter(exercise => exercise.roleplayId === roleplay.roleplayId).length;
|
|
120
|
+
const count = selectedExercises?.filter(exercise => exercise.roleplayId === roleplay.roleplayId).length || 0;
|
|
122
121
|
setIsSelectAllChecked(count === games.length);
|
|
122
|
+
setIndeterminate(count > 0 && count < games.length);
|
|
123
123
|
const roleplayNames = selectedExercises?.filter(ex => ex.roleplayId === roleplay.roleplayId).map(ex => ex.name);
|
|
124
124
|
setSelectedGames(roleplayNames);
|
|
125
125
|
}, [selectedExercises, roleplay.roleplayId]);
|
|
@@ -130,6 +130,8 @@ function Roleplay({
|
|
|
130
130
|
name: name
|
|
131
131
|
}));
|
|
132
132
|
handleSelectExercise(removeExercises);
|
|
133
|
+
setIsSelectAllChecked(false);
|
|
134
|
+
setIndeterminate(false);
|
|
133
135
|
} else {
|
|
134
136
|
let gamesToAdd = [];
|
|
135
137
|
games.forEach(name => {
|
|
@@ -143,6 +145,8 @@ function Roleplay({
|
|
|
143
145
|
}
|
|
144
146
|
});
|
|
145
147
|
handleSelectExercise(gamesToAdd);
|
|
148
|
+
setIsSelectAllChecked(true);
|
|
149
|
+
setIndeterminate(false);
|
|
146
150
|
}
|
|
147
151
|
};
|
|
148
152
|
const isRoleplayEmpty = roleplay?.script?.length === 0 || !roleplay?.script?.some(line => line.text !== undefined);
|
|
@@ -271,6 +275,7 @@ function Roleplay({
|
|
|
271
275
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
272
276
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
273
277
|
checked: isSelectAllChecked,
|
|
278
|
+
indeterminate: indeterminate,
|
|
274
279
|
onChange: handleSelectAll,
|
|
275
280
|
onClick: event => {
|
|
276
281
|
event.stopPropagation();
|
|
@@ -14,8 +14,6 @@ var _AdapterDayjs = require("@mui/x-date-pickers/AdapterDayjs");
|
|
|
14
14
|
var _LocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
|
|
15
15
|
var _DatePicker = require("@mui/x-date-pickers/DatePicker");
|
|
16
16
|
var _mui = require("tss-react/mui");
|
|
17
|
-
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
18
|
-
var _ArrowDropUp = _interopRequireDefault(require("@mui/icons-material/ArrowDropUp"));
|
|
19
17
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
20
18
|
var _AssignmentSelectExercise = _interopRequireDefault(require("../AssignmentSelectExercise/AssignmentSelectExercise"));
|
|
21
19
|
var _AssignmentExerciseSelector = _interopRequireDefault(require("../AssignmentExerciseSelector/AssignmentExerciseSelector"));
|
|
@@ -57,7 +55,7 @@ function CreateAssignmentDialog({
|
|
|
57
55
|
getCourses,
|
|
58
56
|
initialData = {},
|
|
59
57
|
dialogTitle,
|
|
60
|
-
userEmail =
|
|
58
|
+
userEmail = ""
|
|
61
59
|
}) {
|
|
62
60
|
const {
|
|
63
61
|
classes
|
|
@@ -71,14 +69,15 @@ function CreateAssignmentDialog({
|
|
|
71
69
|
const [assignment, setAssignment] = (0, _react.useState)({
|
|
72
70
|
classroomId: classroom?.length > 0 ? [classroom] : [],
|
|
73
71
|
assignedStudents: members?.map(member => member.memberId),
|
|
74
|
-
title:
|
|
75
|
-
instructions: "",
|
|
72
|
+
title: initialData.title ? initialData.title : undefined,
|
|
73
|
+
instructions: initialData.instructions ? initialData.instructions : t("default_assignment_instructions"),
|
|
76
74
|
type: "assignment",
|
|
77
75
|
scheduleDate: (0, _dayjs.default)(),
|
|
78
76
|
dueDate: (0, _dayjs.default)().add(1, "day"),
|
|
79
77
|
exercises: submittedExercises,
|
|
80
78
|
...initialData
|
|
81
79
|
});
|
|
80
|
+
const [isTitleEdited, setIsTitleEdited] = (0, _react.useState)(Boolean(initialData.title));
|
|
82
81
|
const classroomQuery = useQueries({
|
|
83
82
|
queries: (Array.isArray(assignment.classroomId) ? assignment.classroomId : [assignment.classroomId]).map(cId => ({
|
|
84
83
|
queryKey: _Queries.classrooms.classroomKeys.item(cId, username),
|
|
@@ -178,11 +177,26 @@ function CreateAssignmentDialog({
|
|
|
178
177
|
}, [coursesQuery.data, coursesQuery.isSuccess, classrooms, assignment.classroomId]);
|
|
179
178
|
(0, _react.useEffect)(() => {
|
|
180
179
|
let filteredCourses = selectedCourses.filter(course => submittedExercises.some(exercise => exercise.courseSectionTopicId?.split("|")[0] === course.courseId));
|
|
181
|
-
setAssignment({
|
|
182
|
-
...
|
|
180
|
+
setAssignment(prev => ({
|
|
181
|
+
...prev,
|
|
183
182
|
courses: filteredCourses
|
|
183
|
+
}));
|
|
184
|
+
const selectedTopicIds = new Set(submittedExercises.map(ex => ex.courseSectionTopicId));
|
|
185
|
+
const topicNames = Array.from(new Set(filteredCourses.flatMap(course => course.sections?.flatMap(section => section.topics?.flatMap(topic => {
|
|
186
|
+
const topicKey = `${course.courseId}|${section.sectionId}|${topic.topicId}`;
|
|
187
|
+
return selectedTopicIds.has(topicKey) ? topic.topicName : [];
|
|
188
|
+
}))).filter(Boolean)));
|
|
189
|
+
setAssignment(prev => {
|
|
190
|
+
const newTitle = topicNames.length ? topicNames.join(", ") : undefined;
|
|
191
|
+
if (isTitleEdited && prev.title) {
|
|
192
|
+
return prev;
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
...prev,
|
|
196
|
+
title: newTitle
|
|
197
|
+
};
|
|
184
198
|
});
|
|
185
|
-
}, [selectedCourses, submittedExercises]);
|
|
199
|
+
}, [selectedCourses, submittedExercises, isTitleEdited]);
|
|
186
200
|
const classroomMembers = async uniqueClassroomMembers => {
|
|
187
201
|
const formattedMembers = await getMemberDetails(uniqueClassroomMembers);
|
|
188
202
|
setMembers(formattedMembers);
|
|
@@ -212,40 +226,38 @@ function CreateAssignmentDialog({
|
|
|
212
226
|
const handleCloseSelectExercise = () => {
|
|
213
227
|
setIsSelectExerciseOpen(false);
|
|
214
228
|
};
|
|
215
|
-
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
|
216
|
-
const handleMenuOpen = event => {
|
|
217
|
-
setAnchorEl(event.currentTarget);
|
|
218
|
-
};
|
|
219
|
-
const handleMenuClose = () => {
|
|
220
|
-
setAnchorEl(null);
|
|
221
|
-
};
|
|
222
229
|
const handleChange = field => event => {
|
|
223
230
|
let value = event?.target?.value ?? event;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if (field === "classroomId") {
|
|
232
|
-
return {
|
|
233
|
-
...prev,
|
|
234
|
-
classroomId: typeof value === "string" ? value.split(",") : value
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
if (field === "classroom") {
|
|
238
|
-
return {
|
|
239
|
-
...prev,
|
|
240
|
-
classroomId: value,
|
|
241
|
-
assignedStudents: []
|
|
242
|
-
};
|
|
231
|
+
if (field === "title") {
|
|
232
|
+
setIsTitleEdited(true);
|
|
233
|
+
}
|
|
234
|
+
if (field === "assignedStudents") {
|
|
235
|
+
if (value.includes("select-all")) {
|
|
236
|
+
const allSelected = assignment.assignedStudents.length === members.length;
|
|
237
|
+
value = allSelected ? [] : members.map(m => m.memberId);
|
|
243
238
|
}
|
|
244
|
-
return {
|
|
239
|
+
return setAssignment(prev => ({
|
|
245
240
|
...prev,
|
|
246
|
-
|
|
247
|
-
};
|
|
248
|
-
}
|
|
241
|
+
assignedStudents: typeof value === "string" ? value.split(",") : value
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
if (field === "classroomId") {
|
|
245
|
+
return setAssignment(prev => ({
|
|
246
|
+
...prev,
|
|
247
|
+
classroomId: typeof value === "string" ? value.split(",") : value
|
|
248
|
+
}));
|
|
249
|
+
}
|
|
250
|
+
if (field === "classroom") {
|
|
251
|
+
return setAssignment(prev => ({
|
|
252
|
+
...prev,
|
|
253
|
+
classroomId: value,
|
|
254
|
+
assignedStudents: []
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
return setAssignment(prev => ({
|
|
258
|
+
...prev,
|
|
259
|
+
[field]: value
|
|
260
|
+
}));
|
|
249
261
|
};
|
|
250
262
|
const handleCreateAssignment = async () => {
|
|
251
263
|
try {
|
|
@@ -331,7 +343,7 @@ function CreateAssignmentDialog({
|
|
|
331
343
|
MenuProps: {
|
|
332
344
|
PaperProps: {
|
|
333
345
|
sx: {
|
|
334
|
-
width:
|
|
346
|
+
width: "auto",
|
|
335
347
|
maxWidth: 400
|
|
336
348
|
}
|
|
337
349
|
},
|
|
@@ -390,21 +402,6 @@ function CreateAssignmentDialog({
|
|
|
390
402
|
})
|
|
391
403
|
}, c.classroomId))
|
|
392
404
|
})]
|
|
393
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
394
|
-
"data-cy": "assignment-title-input",
|
|
395
|
-
label: t("assignment_title"),
|
|
396
|
-
fullWidth: true,
|
|
397
|
-
value: assignment.title,
|
|
398
|
-
onChange: handleChange("title"),
|
|
399
|
-
required: true
|
|
400
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
401
|
-
"data-cy": "assignment-description-input",
|
|
402
|
-
label: t("assignment_description"),
|
|
403
|
-
fullWidth: true,
|
|
404
|
-
multiline: true,
|
|
405
|
-
rows: 3,
|
|
406
|
-
value: assignment.instructions,
|
|
407
|
-
onChange: handleChange("instructions")
|
|
408
405
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
409
406
|
disableHoverListener: selectedCourses?.length > 0,
|
|
410
407
|
disableFocusListener: selectedCourses?.length > 0,
|
|
@@ -412,7 +409,7 @@ function CreateAssignmentDialog({
|
|
|
412
409
|
title: t("no_shared_courses"),
|
|
413
410
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
414
411
|
style: {
|
|
415
|
-
display:
|
|
412
|
+
display: "inline-block"
|
|
416
413
|
},
|
|
417
414
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
418
415
|
"data-cy": "assignment-exercise-selector-button",
|
|
@@ -453,24 +450,70 @@ function CreateAssignmentDialog({
|
|
|
453
450
|
flexDirection: "column",
|
|
454
451
|
gap: 2
|
|
455
452
|
},
|
|
456
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
453
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
454
|
+
"data-cy": "assignment-title-input",
|
|
455
|
+
label: t("assignment_title"),
|
|
456
|
+
fullWidth: true,
|
|
457
|
+
value: assignment.title,
|
|
458
|
+
onChange: handleChange("title"),
|
|
459
|
+
required: true,
|
|
460
|
+
InputLabelProps: {
|
|
461
|
+
shrink: true
|
|
462
|
+
}
|
|
463
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
464
|
+
"data-cy": "assignment-description-input",
|
|
465
|
+
label: t("assignment_description"),
|
|
466
|
+
fullWidth: true,
|
|
467
|
+
multiline: true,
|
|
468
|
+
rows: 3,
|
|
469
|
+
value: assignment.instructions,
|
|
470
|
+
onChange: handleChange("instructions")
|
|
471
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
457
472
|
fullWidth: true,
|
|
458
473
|
disabled: !assignment.classroomId,
|
|
459
474
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
460
475
|
id: "members-label",
|
|
461
476
|
required: true,
|
|
462
|
-
children: t("
|
|
463
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
477
|
+
children: t("assign_to")
|
|
478
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Select, {
|
|
464
479
|
labelId: "members-label",
|
|
465
480
|
id: "assignedStudents",
|
|
466
481
|
"data-cy": "assignment-members-selector",
|
|
467
|
-
label: t("
|
|
482
|
+
label: t("assign_to"),
|
|
468
483
|
multiple: true,
|
|
469
484
|
required: true,
|
|
470
485
|
value: assignment.assignedStudents,
|
|
471
486
|
onChange: handleChange("assignedStudents"),
|
|
472
|
-
renderValue: selected => selected?.map(memberId => members?.find(member => member.memberId === memberId))?.map(member => member?.username).join(", "),
|
|
473
|
-
|
|
487
|
+
renderValue: selected => assignment.assignedStudents.length === members.length ? t("all_students") : selected?.map(memberId => members?.find(member => member.memberId === memberId))?.map(member => member?.username).join(", "),
|
|
488
|
+
MenuProps: {
|
|
489
|
+
PaperProps: {
|
|
490
|
+
sx: {
|
|
491
|
+
maxHeight: 300
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
MenuListProps: {
|
|
495
|
+
disablePadding: true
|
|
496
|
+
},
|
|
497
|
+
autoFocus: false,
|
|
498
|
+
disableAutoFocusItem: true
|
|
499
|
+
},
|
|
500
|
+
children: [members.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
501
|
+
value: "select-all",
|
|
502
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
503
|
+
sx: {
|
|
504
|
+
display: "flex",
|
|
505
|
+
alignItems: "center",
|
|
506
|
+
justifyContent: "space-between",
|
|
507
|
+
width: "100%"
|
|
508
|
+
},
|
|
509
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
510
|
+
primary: t("all_students")
|
|
511
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
512
|
+
checked: assignment.assignedStudents.length === members.length,
|
|
513
|
+
indeterminate: assignment.assignedStudents.length > 0 && assignment.assignedStudents.length < members.length
|
|
514
|
+
})]
|
|
515
|
+
})
|
|
516
|
+
}), members.map(member => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
474
517
|
value: member.memberId,
|
|
475
518
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
476
519
|
src: member.userImage,
|
|
@@ -482,19 +525,51 @@ function CreateAssignmentDialog({
|
|
|
482
525
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
483
526
|
checked: assignment.assignedStudents?.includes(member.memberId)
|
|
484
527
|
})]
|
|
485
|
-
}, member.memberId))
|
|
528
|
+
}, member.memberId))]
|
|
529
|
+
})]
|
|
530
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
531
|
+
sx: {
|
|
532
|
+
display: "flex",
|
|
533
|
+
width: "100%",
|
|
534
|
+
alignItems: "center",
|
|
535
|
+
justifyContent: "space-between"
|
|
536
|
+
},
|
|
537
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalizationProvider.LocalizationProvider, {
|
|
538
|
+
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
539
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, {
|
|
540
|
+
label: t("assign_date"),
|
|
541
|
+
value: assignment.scheduleDate,
|
|
542
|
+
onChange: date => setAssignment(prev => ({
|
|
543
|
+
...prev,
|
|
544
|
+
scheduleDate: date
|
|
545
|
+
})),
|
|
546
|
+
disablePast: true,
|
|
547
|
+
maxDate: assignment.dueDate,
|
|
548
|
+
sx: {
|
|
549
|
+
width: "45%"
|
|
550
|
+
},
|
|
551
|
+
format: "DD MMM YYYY"
|
|
552
|
+
})
|
|
553
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
554
|
+
variant: "h4",
|
|
555
|
+
children: "-"
|
|
556
|
+
}), " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalizationProvider.LocalizationProvider, {
|
|
557
|
+
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
558
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, {
|
|
559
|
+
"data-cy": "assignment-date-picker",
|
|
560
|
+
label: t("due"),
|
|
561
|
+
value: assignment.dueDate,
|
|
562
|
+
disablePast: true,
|
|
563
|
+
onChange: date => setAssignment(prev => ({
|
|
564
|
+
...prev,
|
|
565
|
+
dueDate: date
|
|
566
|
+
})),
|
|
567
|
+
sx: {
|
|
568
|
+
width: "45%"
|
|
569
|
+
},
|
|
570
|
+
format: "DD MMM YYYY"
|
|
571
|
+
})
|
|
486
572
|
})]
|
|
487
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalizationProvider.LocalizationProvider, {
|
|
488
|
-
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
489
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, {
|
|
490
|
-
"data-cy": "assignment-date-picker",
|
|
491
|
-
label: t("due_date"),
|
|
492
|
-
value: assignment.dueDate,
|
|
493
|
-
onChange: date => setAssignment(prev => ({
|
|
494
|
-
...prev,
|
|
495
|
-
dueDate: date
|
|
496
|
-
}))
|
|
497
|
-
})
|
|
498
573
|
})]
|
|
499
574
|
})
|
|
500
575
|
})]
|
|
@@ -517,66 +592,17 @@ function CreateAssignmentDialog({
|
|
|
517
592
|
},
|
|
518
593
|
onClick: handleClose,
|
|
519
594
|
children: t("cancel")
|
|
520
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
595
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ButtonGroup, {
|
|
521
596
|
variant: "contained",
|
|
522
597
|
color: "primary",
|
|
523
598
|
sx: {
|
|
524
599
|
borderRadius: 10
|
|
525
600
|
},
|
|
526
|
-
children:
|
|
601
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
527
602
|
"data-cy": "assignment-assign-button",
|
|
528
603
|
disabled: !assignment.assignedStudents?.length || !assignment.scheduleDate || !assignment.dueDate || !assignment.title || !assignment.classroomId || !assignment.exercises?.length,
|
|
529
604
|
onClick: async () => await handleCreateAssignment(),
|
|
530
605
|
children: t("assign")
|
|
531
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
532
|
-
color: "primary",
|
|
533
|
-
onClick: handleMenuOpen,
|
|
534
|
-
sx: {
|
|
535
|
-
minWidth: "40px",
|
|
536
|
-
padding: "6px"
|
|
537
|
-
},
|
|
538
|
-
disabled: !assignment.assignedStudents?.length || !assignment.scheduleDate || !assignment.dueDate || !assignment.title || !assignment.classroomId || !assignment.exercises?.length,
|
|
539
|
-
children: anchorEl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropUp.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropDown.default, {})
|
|
540
|
-
})]
|
|
541
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popover, {
|
|
542
|
-
anchorEl: anchorEl,
|
|
543
|
-
open: Boolean(anchorEl),
|
|
544
|
-
onClose: handleMenuClose,
|
|
545
|
-
anchorOrigin: {
|
|
546
|
-
vertical: "top",
|
|
547
|
-
horizontal: "left"
|
|
548
|
-
},
|
|
549
|
-
transformOrigin: {
|
|
550
|
-
vertical: "bottom",
|
|
551
|
-
horizontal: "left"
|
|
552
|
-
},
|
|
553
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
554
|
-
display: "flex",
|
|
555
|
-
flexDirection: "column",
|
|
556
|
-
width: "100%",
|
|
557
|
-
gap: 1,
|
|
558
|
-
padding: 2,
|
|
559
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalizationProvider.LocalizationProvider, {
|
|
560
|
-
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
561
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, {
|
|
562
|
-
label: t("assign_date"),
|
|
563
|
-
value: assignment.scheduleDate,
|
|
564
|
-
onChange: date => setAssignment(prev => ({
|
|
565
|
-
...prev,
|
|
566
|
-
scheduleDate: date
|
|
567
|
-
}))
|
|
568
|
-
})
|
|
569
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
570
|
-
variant: "outlined",
|
|
571
|
-
color: "primary",
|
|
572
|
-
fullWidth: true,
|
|
573
|
-
"data-cy": "assignment-schedule-button",
|
|
574
|
-
onClick: async () => {
|
|
575
|
-
await handleCreateAssignment();
|
|
576
|
-
handleMenuClose();
|
|
577
|
-
},
|
|
578
|
-
children: t("schedule_assignment")
|
|
579
|
-
})]
|
|
580
606
|
})
|
|
581
607
|
})]
|
|
582
608
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentSelectExercise.default, {
|
|
@@ -114,7 +114,7 @@ function OverflowMenu({
|
|
|
114
114
|
onClick: async () => {
|
|
115
115
|
await handleDuplicateCourse(course, classroomId);
|
|
116
116
|
},
|
|
117
|
-
disabled: !canDuplicateCourse || course.duplicated,
|
|
117
|
+
disabled: !canDuplicateCourse || course.duplicated && course.duplicatedBy !== 'creator',
|
|
118
118
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
|
|
119
119
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FileCopy.default, {
|
|
120
120
|
fontSize: "small"
|
|
@@ -1211,16 +1211,6 @@ function Editor({
|
|
|
1211
1211
|
topicPhrases: topicPhrases,
|
|
1212
1212
|
updateRivescriptJSON: updateRivescriptJSON,
|
|
1213
1213
|
initialTopicGoal: initialTopicGoal
|
|
1214
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
1215
|
-
display: "flex",
|
|
1216
|
-
alignItems: "center",
|
|
1217
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DefaultColourButton.default, {
|
|
1218
|
-
size: "small",
|
|
1219
|
-
onClick: handleOpenEditorModal,
|
|
1220
|
-
endIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowForward.default, {}),
|
|
1221
|
-
variant: "outlined",
|
|
1222
|
-
children: t("advanced_editor")
|
|
1223
|
-
})
|
|
1224
1214
|
})]
|
|
1225
1215
|
}) : null]
|
|
1226
1216
|
})
|
|
@@ -103,7 +103,11 @@ function Bot({
|
|
|
103
103
|
parentClassroom,
|
|
104
104
|
isHeritageSpeaker,
|
|
105
105
|
classroomId,
|
|
106
|
-
assignment
|
|
106
|
+
assignment,
|
|
107
|
+
i18nLanguage,
|
|
108
|
+
isDynamicResponsesEnabled,
|
|
109
|
+
aiChatbotConversationHistory,
|
|
110
|
+
isUserInternal
|
|
107
111
|
}) {
|
|
108
112
|
const theme = (0, _styles.useTheme)();
|
|
109
113
|
const {
|
|
@@ -181,7 +185,11 @@ function Bot({
|
|
|
181
185
|
clearQueue,
|
|
182
186
|
stopAudio,
|
|
183
187
|
isHeritageSpeaker,
|
|
184
|
-
classroomId
|
|
188
|
+
classroomId,
|
|
189
|
+
i18nLanguage,
|
|
190
|
+
isDynamicResponsesEnabled,
|
|
191
|
+
aiChatbotConversationHistory,
|
|
192
|
+
isUserInternal
|
|
185
193
|
});
|
|
186
194
|
const {
|
|
187
195
|
muteSound,
|
|
@@ -21,7 +21,8 @@ function BotSettings({
|
|
|
21
21
|
errors,
|
|
22
22
|
handleChange,
|
|
23
23
|
handleBlur,
|
|
24
|
-
subscription
|
|
24
|
+
subscription,
|
|
25
|
+
isUserInternal
|
|
25
26
|
}) {
|
|
26
27
|
const {
|
|
27
28
|
classes
|
|
@@ -29,7 +30,8 @@ function BotSettings({
|
|
|
29
30
|
const {
|
|
30
31
|
visibility,
|
|
31
32
|
translationEnabled,
|
|
32
|
-
isAdvancedBot
|
|
33
|
+
isAdvancedBot,
|
|
34
|
+
isDynamicResponsesEnabled
|
|
33
35
|
} = values;
|
|
34
36
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
35
37
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
@@ -137,6 +139,36 @@ function BotSettings({
|
|
|
137
139
|
})]
|
|
138
140
|
})]
|
|
139
141
|
})]
|
|
142
|
+
}), isUserInternal && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
143
|
+
size: 12,
|
|
144
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
145
|
+
gutterBottom: true,
|
|
146
|
+
children: t("dynamic_response_desc")
|
|
147
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
148
|
+
component: "fieldset",
|
|
149
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
|
|
150
|
+
component: "legend",
|
|
151
|
+
children: t("dynamic_response")
|
|
152
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
|
|
153
|
+
className: classes.group,
|
|
154
|
+
"aria-label": "isDynamicResponsesEnabled",
|
|
155
|
+
name: "isDynamicResponsesEnabled",
|
|
156
|
+
value: isDynamicResponsesEnabled,
|
|
157
|
+
onChange: handleChange,
|
|
158
|
+
onBlur: handleBlur,
|
|
159
|
+
helperText: touched.isDynamicResponsesEnabled ? errors.isDynamicResponsesEnabled : "",
|
|
160
|
+
error: touched.isDynamicResponsesEnabled && Boolean(errors.isDynamicResponsesEnabled),
|
|
161
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
162
|
+
value: "enable",
|
|
163
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
164
|
+
label: t("enable")
|
|
165
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
166
|
+
value: "disable",
|
|
167
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
168
|
+
label: t("disable")
|
|
169
|
+
})]
|
|
170
|
+
})]
|
|
171
|
+
})]
|
|
140
172
|
})]
|
|
141
173
|
})
|
|
142
174
|
});
|
|
@@ -49,7 +49,8 @@ const useStyles = (0, _mui.makeStyles)()(theme => ({
|
|
|
49
49
|
function Confirmation({
|
|
50
50
|
t = text => text,
|
|
51
51
|
values,
|
|
52
|
-
subscription
|
|
52
|
+
subscription,
|
|
53
|
+
isUserInternal
|
|
53
54
|
}) {
|
|
54
55
|
const {
|
|
55
56
|
classes
|
|
@@ -58,7 +59,8 @@ function Confirmation({
|
|
|
58
59
|
visibility,
|
|
59
60
|
translationEnabled,
|
|
60
61
|
studentInstructions,
|
|
61
|
-
isAdvancedBot
|
|
62
|
+
isAdvancedBot,
|
|
63
|
+
isDynamicResponsesEnabled
|
|
62
64
|
} = values;
|
|
63
65
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
64
66
|
const templateProps = {
|
|
@@ -83,7 +85,7 @@ function Confirmation({
|
|
|
83
85
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
84
86
|
container: true,
|
|
85
87
|
sx: {
|
|
86
|
-
width:
|
|
88
|
+
width: "100%"
|
|
87
89
|
},
|
|
88
90
|
spacing: 1,
|
|
89
91
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
@@ -173,6 +175,35 @@ function Confirmation({
|
|
|
173
175
|
})]
|
|
174
176
|
})]
|
|
175
177
|
})]
|
|
178
|
+
}), isUserInternal && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
179
|
+
size: 12,
|
|
180
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
181
|
+
gutterBottom: true,
|
|
182
|
+
display: "block",
|
|
183
|
+
children: t("dynamic_response_desc")
|
|
184
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
185
|
+
component: "fieldset",
|
|
186
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
|
|
187
|
+
component: "legend",
|
|
188
|
+
children: t("dynamic_response")
|
|
189
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
|
|
190
|
+
className: classes.group,
|
|
191
|
+
"aria-label": "isDynamicResponsesEnabled",
|
|
192
|
+
name: "isDynamicResponsesEnabled",
|
|
193
|
+
value: isDynamicResponsesEnabled,
|
|
194
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
195
|
+
disabled: true,
|
|
196
|
+
value: "enable",
|
|
197
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
198
|
+
label: t("enable")
|
|
199
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
200
|
+
disabled: true,
|
|
201
|
+
value: "disable",
|
|
202
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
203
|
+
label: t("disable")
|
|
204
|
+
})]
|
|
205
|
+
})]
|
|
206
|
+
})]
|
|
176
207
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
177
208
|
size: {
|
|
178
209
|
xs: 12,
|
|
@@ -29,7 +29,8 @@ function CourseSettings({
|
|
|
29
29
|
allowedDomains,
|
|
30
30
|
collaborators,
|
|
31
31
|
isShareable,
|
|
32
|
-
duplicated
|
|
32
|
+
duplicated,
|
|
33
|
+
duplicatedBy
|
|
33
34
|
} = values;
|
|
34
35
|
const {
|
|
35
36
|
email
|
|
@@ -92,43 +93,12 @@ function CourseSettings({
|
|
|
92
93
|
value: "public",
|
|
93
94
|
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
94
95
|
label: t("public"),
|
|
95
|
-
disabled: duplicated
|
|
96
|
+
disabled: duplicatedBy === 'community' && duplicated
|
|
96
97
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
97
98
|
value: "private",
|
|
98
99
|
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
99
100
|
label: t("private"),
|
|
100
|
-
disabled: duplicated
|
|
101
|
-
})]
|
|
102
|
-
})]
|
|
103
|
-
})
|
|
104
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
105
|
-
size: {
|
|
106
|
-
xs: 12,
|
|
107
|
-
md: 12
|
|
108
|
-
},
|
|
109
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
110
|
-
component: "fieldset",
|
|
111
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
|
|
112
|
-
component: "legend",
|
|
113
|
-
children: t("duplication")
|
|
114
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
|
|
115
|
-
"aria-label": "duplication",
|
|
116
|
-
name: "isShareable",
|
|
117
|
-
value: isShareable,
|
|
118
|
-
onChange: handleChange,
|
|
119
|
-
onBlur: handleBlur,
|
|
120
|
-
helperText: touched.isShareable ? errors.isShareable : "",
|
|
121
|
-
error: touched.isShareable && Boolean(errors.isShareable),
|
|
122
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
123
|
-
value: "everyone",
|
|
124
|
-
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
125
|
-
label: t("everyone"),
|
|
126
|
-
disabled: duplicated
|
|
127
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
128
|
-
value: "collaborators",
|
|
129
|
-
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
130
|
-
label: t("collaborators_only"),
|
|
131
|
-
disabled: duplicated
|
|
101
|
+
disabled: duplicatedBy === 'community' && duplicated
|
|
132
102
|
})]
|
|
133
103
|
})]
|
|
134
104
|
})
|
|
@@ -184,6 +154,37 @@ function CourseSettings({
|
|
|
184
154
|
fullWidth: true
|
|
185
155
|
})]
|
|
186
156
|
})]
|
|
157
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
158
|
+
size: {
|
|
159
|
+
xs: 12,
|
|
160
|
+
md: 12
|
|
161
|
+
},
|
|
162
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
163
|
+
component: "fieldset",
|
|
164
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
|
|
165
|
+
component: "legend",
|
|
166
|
+
children: t("duplication")
|
|
167
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
|
|
168
|
+
"aria-label": "duplication",
|
|
169
|
+
name: "isShareable",
|
|
170
|
+
value: isShareable,
|
|
171
|
+
onChange: handleChange,
|
|
172
|
+
onBlur: handleBlur,
|
|
173
|
+
helperText: touched.isShareable ? errors.isShareable : "",
|
|
174
|
+
error: touched.isShareable && Boolean(errors.isShareable),
|
|
175
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
176
|
+
value: "everyone",
|
|
177
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
178
|
+
label: t("everyone"),
|
|
179
|
+
disabled: duplicatedBy === 'community' && duplicated
|
|
180
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
181
|
+
value: "collaborators",
|
|
182
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
183
|
+
label: t("collaborators_only"),
|
|
184
|
+
disabled: duplicatedBy === 'community' && duplicated
|
|
185
|
+
})]
|
|
186
|
+
})]
|
|
187
|
+
})
|
|
187
188
|
})]
|
|
188
189
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
189
190
|
children: t("add_collaborators")
|
|
@@ -216,7 +217,7 @@ function CourseSettings({
|
|
|
216
217
|
variant: "outlined",
|
|
217
218
|
multiline: true,
|
|
218
219
|
fullWidth: true,
|
|
219
|
-
restrictCollaboratorDomains: duplicated,
|
|
220
|
+
restrictCollaboratorDomains: duplicatedBy === 'community' && duplicated,
|
|
220
221
|
userEmail: email
|
|
221
222
|
}), !subscription.isPaidUser && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
222
223
|
title: subscription.isUpgradePossible ? t("upgrade_plan_explanation") : t("upgrade_subscription_student"),
|
|
@@ -237,7 +238,7 @@ function CourseSettings({
|
|
|
237
238
|
variant: "outlined",
|
|
238
239
|
multiline: true,
|
|
239
240
|
fullWidth: true,
|
|
240
|
-
restrictCollaboratorDomains: duplicated,
|
|
241
|
+
restrictCollaboratorDomains: duplicatedBy === 'community' && duplicated,
|
|
241
242
|
userEmail: email
|
|
242
243
|
})
|
|
243
244
|
})]
|
|
@@ -43,7 +43,8 @@ function UpdateBot({
|
|
|
43
43
|
creatorInstructions: "",
|
|
44
44
|
studentInstructions: "",
|
|
45
45
|
tags: [],
|
|
46
|
-
phrasesToBoost: []
|
|
46
|
+
phrasesToBoost: [],
|
|
47
|
+
isDynamicResponsesEnabled: "enable"
|
|
47
48
|
},
|
|
48
49
|
verificationStatus,
|
|
49
50
|
onSubmit,
|
|
@@ -79,7 +80,8 @@ function UpdateBot({
|
|
|
79
80
|
studentInstructions,
|
|
80
81
|
introMessage,
|
|
81
82
|
tags,
|
|
82
|
-
phrasesToBoost
|
|
83
|
+
phrasesToBoost,
|
|
84
|
+
isDynamicResponsesEnabled
|
|
83
85
|
} = initialValues;
|
|
84
86
|
const difficultyOptions = difficulties.map((d, idx) => {
|
|
85
87
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
@@ -172,7 +174,8 @@ function UpdateBot({
|
|
|
172
174
|
initialValues: {
|
|
173
175
|
visibility,
|
|
174
176
|
translationEnabled,
|
|
175
|
-
picture
|
|
177
|
+
picture,
|
|
178
|
+
isDynamicResponsesEnabled
|
|
176
179
|
},
|
|
177
180
|
enableReinitialize: enableReinitialize,
|
|
178
181
|
validationSchema: _Steps.BotSettings.validationSchema,
|
|
@@ -213,7 +216,8 @@ function UpdateBot({
|
|
|
213
216
|
values: values,
|
|
214
217
|
...otherProps,
|
|
215
218
|
isUpdating: true,
|
|
216
|
-
subscription: subscription
|
|
219
|
+
subscription: subscription,
|
|
220
|
+
isUserInternal: isUserInternal
|
|
217
221
|
})
|
|
218
222
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardActions.default, {
|
|
219
223
|
className: classes.padding,
|
|
@@ -33,7 +33,8 @@ function UpdateCourse({
|
|
|
33
33
|
collaborators: [],
|
|
34
34
|
picture: null,
|
|
35
35
|
isShareable: "",
|
|
36
|
-
duplicated: false
|
|
36
|
+
duplicated: false,
|
|
37
|
+
duplicatedBy: ""
|
|
37
38
|
},
|
|
38
39
|
difficulties = ["A1", "A2", "B1", "B2", "C1", "C2"],
|
|
39
40
|
onSubmit,
|
|
@@ -69,7 +70,8 @@ function UpdateCourse({
|
|
|
69
70
|
tags,
|
|
70
71
|
collaborators,
|
|
71
72
|
isShareable,
|
|
72
|
-
duplicated
|
|
73
|
+
duplicated,
|
|
74
|
+
duplicatedBy
|
|
73
75
|
} = initialValues;
|
|
74
76
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
75
77
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, {
|
|
@@ -144,7 +146,8 @@ function UpdateCourse({
|
|
|
144
146
|
allowedDomains,
|
|
145
147
|
collaborators,
|
|
146
148
|
isShareable: isShareable ?? "collaborators",
|
|
147
|
-
duplicated
|
|
149
|
+
duplicated,
|
|
150
|
+
duplicatedBy
|
|
148
151
|
},
|
|
149
152
|
enableReinitialize: enableReinitialize,
|
|
150
153
|
validationSchema: _Steps.CourseSettings.validationSchema,
|
|
@@ -64,7 +64,8 @@ function Courses({
|
|
|
64
64
|
username,
|
|
65
65
|
memberId,
|
|
66
66
|
handleDuplicateCourse,
|
|
67
|
-
email
|
|
67
|
+
email,
|
|
68
|
+
isTeacher
|
|
68
69
|
}) {
|
|
69
70
|
const {
|
|
70
71
|
classes
|
|
@@ -138,7 +139,8 @@ function Courses({
|
|
|
138
139
|
username: username,
|
|
139
140
|
handleDuplicateCourse: handleDuplicateCourse,
|
|
140
141
|
cardTitleComponent: "h2",
|
|
141
|
-
email: email
|
|
142
|
+
email: email,
|
|
143
|
+
isTeacher: isTeacher
|
|
142
144
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
143
145
|
py: 2,
|
|
144
146
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Courses2.default, {
|
|
@@ -176,7 +178,8 @@ function Courses({
|
|
|
176
178
|
memberId: memberId,
|
|
177
179
|
username: username,
|
|
178
180
|
handleDuplicateCourse: handleDuplicateCourse,
|
|
179
|
-
cardTitleComponent: "h2"
|
|
181
|
+
cardTitleComponent: "h2",
|
|
182
|
+
isTeacher: isTeacher
|
|
180
183
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
181
184
|
py: 2,
|
|
182
185
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Courses2.default, {
|
|
@@ -68,7 +68,11 @@ function useExerciseState({
|
|
|
68
68
|
isCreator,
|
|
69
69
|
isKeyboardHiddenTranslation,
|
|
70
70
|
isHeritageSpeaker = false,
|
|
71
|
-
classroomId
|
|
71
|
+
classroomId,
|
|
72
|
+
i18nLanguage,
|
|
73
|
+
isDynamicResponsesEnabled,
|
|
74
|
+
aiChatbotConversationHistory,
|
|
75
|
+
isUserInternal
|
|
72
76
|
}) {
|
|
73
77
|
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
74
78
|
const [questions, setQuestions] = (0, _react.useState)([]);
|
|
@@ -122,6 +126,8 @@ function useExerciseState({
|
|
|
122
126
|
const [isWordBankAttemptChanged, setIsWordBankAttemptChanged] = (0, _react.useState)(false);
|
|
123
127
|
const [isKeyboardHidden, setIsKeyboardHidden] = (0, _react.useState)(false);
|
|
124
128
|
const [isAssignmentExercise, setIsAssignmentExercise] = (0, _react.useState)(false);
|
|
129
|
+
const [isFirstMessage, setIsFirstMessage] = (0, _react.useState)(true);
|
|
130
|
+
const [conversationHistory, setConversationHistory] = (0, _react.useState)([]);
|
|
125
131
|
(0, _react.useEffect)(() => {
|
|
126
132
|
if (isLiveGame && existingMessages && existingMessages.length > 0) {
|
|
127
133
|
setRoleplayMessages(existingMessages);
|
|
@@ -1154,7 +1160,6 @@ function useExerciseState({
|
|
|
1154
1160
|
if (isSkipped === true) {
|
|
1155
1161
|
handleExerciseSkip(answerAttempt);
|
|
1156
1162
|
}
|
|
1157
|
-
console.log("answerAttempt is", answerAttempt);
|
|
1158
1163
|
if (isCorrect && isCaseCorrect) {
|
|
1159
1164
|
handleCorrect(answerAttempt);
|
|
1160
1165
|
} else if (correctWordCounter >= 1 && !isCaseCorrect) {
|
|
@@ -1528,7 +1533,13 @@ function useExerciseState({
|
|
|
1528
1533
|
resetTranscript();
|
|
1529
1534
|
const body = {
|
|
1530
1535
|
message: botText,
|
|
1531
|
-
vars: botVars
|
|
1536
|
+
vars: botVars,
|
|
1537
|
+
isFirstMessage: aiChatbotConversationHistory.length !== 0 ? false : isFirstMessage,
|
|
1538
|
+
i18nLanguage,
|
|
1539
|
+
isDynamicResponsesEnabled: isUserInternal ? isDynamicResponsesEnabled === "enable" ? true : false : false,
|
|
1540
|
+
conversationHistory,
|
|
1541
|
+
botProgess: aiChatbotConversationHistory,
|
|
1542
|
+
botTemplate: bot.selectedTemplate ? bot.selectedTemplate : ''
|
|
1532
1543
|
};
|
|
1533
1544
|
const response = await handleMessageBot(bot.botId, body);
|
|
1534
1545
|
if (response.errorMessage) {
|
|
@@ -1539,11 +1550,13 @@ function useExerciseState({
|
|
|
1539
1550
|
if (response && response.reply) {
|
|
1540
1551
|
setBotText("");
|
|
1541
1552
|
setBotVars(response.vars);
|
|
1553
|
+
setConversationHistory(response.conversationHistory);
|
|
1542
1554
|
handleReset();
|
|
1543
1555
|
if (clearAttemptAudio) {
|
|
1544
1556
|
clearAttemptAudio();
|
|
1545
1557
|
}
|
|
1546
1558
|
addBotMessage(response.reply, false, true);
|
|
1559
|
+
setIsFirstMessage(false);
|
|
1547
1560
|
}
|
|
1548
1561
|
} catch (error) {
|
|
1549
1562
|
console.error(error);
|