@nualang/nualang-ui-components 0.1.1215 → 0.1.1217
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/Chat/Messages/Message/Message.js +66 -16
- package/dist/Dialogs/CreateAssignmentScreen/CreateAssignmentScreen.js +156 -41
- package/dist/Dialogs/SelectExercise/SelectExercise.js +13 -4
- package/dist/Exercises/Listener/Listener.js +3 -3
- package/dist/Lists/AssignmentCardsList/AssignmentCardsList.js +4 -2
- package/dist/Lists/ExerciseSelection/ExerciseSelection.js +1 -1
- package/dist/Lists/Members/Members.js +0 -16
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +19 -1
- package/dist/hooks/useExerciseState.js +4 -2
- package/dist/hooks/useRecognition.js +11 -2
- package/dist/utils/index.js +6 -1
- package/package.json +1 -1
|
@@ -24,14 +24,14 @@ var _VoiceMessage = _interopRequireDefault(require("../../VoiceMessage"));
|
|
|
24
24
|
var _material = require("@mui/material");
|
|
25
25
|
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
26
26
|
var _DragIndicator = _interopRequireDefault(require("@mui/icons-material/DragIndicator"));
|
|
27
|
+
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
28
|
+
var _BorderColor = _interopRequireDefault(require("@mui/icons-material/BorderColor"));
|
|
27
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
30
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
31
|
const useStyles = (0, _mui.makeStyles)()((theme, {
|
|
30
32
|
isMyMessage,
|
|
31
33
|
isButton,
|
|
32
34
|
hideAvatar,
|
|
33
|
-
messages,
|
|
34
|
-
index,
|
|
35
35
|
isHighlighted
|
|
36
36
|
}) => ({
|
|
37
37
|
root: {
|
|
@@ -297,7 +297,8 @@ function Message({
|
|
|
297
297
|
accessibilityIndex,
|
|
298
298
|
isLivePlayer = false,
|
|
299
299
|
siteLanguage,
|
|
300
|
-
provided
|
|
300
|
+
provided,
|
|
301
|
+
isEdited = false
|
|
301
302
|
}) {
|
|
302
303
|
const theme = (0, _styles.useTheme)();
|
|
303
304
|
const messageContainerId = `message${messageIndex}`;
|
|
@@ -389,13 +390,37 @@ function Message({
|
|
|
389
390
|
id: messageContainerId,
|
|
390
391
|
"aria-label": `Option ${accessibilityIndex}`,
|
|
391
392
|
onClick: () => onClickButton(text),
|
|
392
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
393
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Grid.default, {
|
|
394
|
+
container: true,
|
|
395
|
+
alignItems: "center",
|
|
396
|
+
justifyContent: "space-between" // Ensures space between name & icon
|
|
397
|
+
,
|
|
398
|
+
sx: {
|
|
399
|
+
display: "flex"
|
|
400
|
+
},
|
|
401
|
+
spacing: 4,
|
|
402
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
403
|
+
item: true,
|
|
404
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
405
|
+
variant: "subtitle2",
|
|
406
|
+
component: "h4",
|
|
407
|
+
gutterBottom: true,
|
|
408
|
+
fontWeight: "bold",
|
|
409
|
+
align: "left",
|
|
410
|
+
children: name
|
|
411
|
+
})
|
|
412
|
+
}), isEdited && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
413
|
+
item: true,
|
|
414
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
415
|
+
title: t("student_edited_transcript"),
|
|
416
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_BorderColor.default, {
|
|
417
|
+
style: {
|
|
418
|
+
color: theme.palette.mode === "dark" ? "#000000" : "#ffffff"
|
|
419
|
+
},
|
|
420
|
+
fontSize: "small"
|
|
421
|
+
})
|
|
422
|
+
})
|
|
423
|
+
})]
|
|
399
424
|
}), !isListenOnly && /*#__PURE__*/(0, _jsxRuntime.jsx)(_HoverText.default, {
|
|
400
425
|
handleTranslate: handleTranslate,
|
|
401
426
|
learnLang: learnLang,
|
|
@@ -424,12 +449,37 @@ function Message({
|
|
|
424
449
|
justifyContent: "space-between"
|
|
425
450
|
},
|
|
426
451
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
427
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
452
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Grid.default, {
|
|
453
|
+
container: true,
|
|
454
|
+
alignItems: "center",
|
|
455
|
+
justifyContent: "space-between" // Ensures space between name & icon
|
|
456
|
+
,
|
|
457
|
+
sx: {
|
|
458
|
+
display: "flex"
|
|
459
|
+
},
|
|
460
|
+
spacing: 4,
|
|
461
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
462
|
+
item: true,
|
|
463
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
464
|
+
variant: "subtitle2",
|
|
465
|
+
component: "h4",
|
|
466
|
+
gutterBottom: true,
|
|
467
|
+
fontWeight: "bold",
|
|
468
|
+
align: "left",
|
|
469
|
+
children: name
|
|
470
|
+
})
|
|
471
|
+
}), isEdited && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
472
|
+
item: true,
|
|
473
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
474
|
+
title: t("student_edited_transcript"),
|
|
475
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_BorderColor.default, {
|
|
476
|
+
style: {
|
|
477
|
+
color: theme.palette.mode === "dark" ? "#000000" : "#ffffff"
|
|
478
|
+
},
|
|
479
|
+
fontSize: "small"
|
|
480
|
+
})
|
|
481
|
+
})
|
|
482
|
+
})]
|
|
433
483
|
}), !isListenOnly && /*#__PURE__*/(0, _jsxRuntime.jsx)(_HoverText.default, {
|
|
434
484
|
handleTranslate: handleTranslate,
|
|
435
485
|
learnLang: learnLang,
|
|
@@ -16,6 +16,8 @@ var _mui = require("tss-react/mui");
|
|
|
16
16
|
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
17
17
|
var _ArrowDropUp = _interopRequireDefault(require("@mui/icons-material/ArrowDropUp"));
|
|
18
18
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
19
|
+
var _SelectExercise = _interopRequireDefault(require("../SelectExercise/SelectExercise"));
|
|
20
|
+
var _Queries = require("@nualang/nualang-api-and-queries/Queries");
|
|
19
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -39,20 +41,92 @@ function Transition(props) {
|
|
|
39
41
|
function CreateAssignmentScreen({
|
|
40
42
|
t,
|
|
41
43
|
classrooms = [],
|
|
44
|
+
classroom,
|
|
45
|
+
getClassroomMembers,
|
|
42
46
|
open,
|
|
43
|
-
handleClose
|
|
47
|
+
handleClose,
|
|
48
|
+
getCourseSections,
|
|
49
|
+
getRoleplays,
|
|
50
|
+
createAssignment,
|
|
51
|
+
username,
|
|
52
|
+
getMemberDetails,
|
|
53
|
+
getClassroom,
|
|
54
|
+
getCourses
|
|
44
55
|
}) {
|
|
45
56
|
const {
|
|
46
57
|
classes
|
|
47
58
|
} = useStyles();
|
|
59
|
+
const [selectedExercises, setSelectedExercises] = (0, _react.useState)([]);
|
|
60
|
+
const [members, setMembers] = (0, _react.useState)([]);
|
|
48
61
|
const [assignment, setAssignment] = (0, _react.useState)({
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
classroomId: "",
|
|
63
|
+
assignedStudents: members?.map(member => member.memberId),
|
|
51
64
|
title: "",
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
instructions: "",
|
|
66
|
+
type: "assignment",
|
|
67
|
+
scheduleDate: (0, _dayjs.default)(),
|
|
68
|
+
dueDate: (0, _dayjs.default)().add(1, "day"),
|
|
69
|
+
exercises: selectedExercises
|
|
55
70
|
});
|
|
71
|
+
const classroomQuery = _Queries.classrooms.useClassroom(async classroomId => {
|
|
72
|
+
const response = await getClassroom(classroomId);
|
|
73
|
+
return response;
|
|
74
|
+
}, {
|
|
75
|
+
classroomId: assignment.classroomId
|
|
76
|
+
}, {
|
|
77
|
+
enabled: !!assignment.classroomId
|
|
78
|
+
});
|
|
79
|
+
const selectedClassroom = (0, _react.useMemo)(() => classroomQuery.isSuccess && classroomQuery.data.Item ? classroomQuery.data.Item : {}, [classroomQuery.data, classroomQuery.isSuccess]);
|
|
80
|
+
const coursesQuery = _Queries.courses.useCourses(async filters => {
|
|
81
|
+
const response = await getCourses(filters);
|
|
82
|
+
return response;
|
|
83
|
+
}, {
|
|
84
|
+
filters: {
|
|
85
|
+
courseIds: selectedClassroom?.courses?.toString()
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
enabled: !!assignment.classroomId
|
|
89
|
+
});
|
|
90
|
+
const membersQuery = _Queries.classrooms.useClassroomMembers(async (classroomId, username) => {
|
|
91
|
+
const response = await getClassroomMembers(classroomId, username);
|
|
92
|
+
return response;
|
|
93
|
+
}, {
|
|
94
|
+
classroomId: assignment.classroomId,
|
|
95
|
+
username: username
|
|
96
|
+
}, {
|
|
97
|
+
enabled: !!assignment.classroomId
|
|
98
|
+
});
|
|
99
|
+
const selectedCourses = (0, _react.useMemo)(() => coursesQuery.isSuccess && Array.isArray(coursesQuery.data.Items) && coursesQuery.data.Items.length ? coursesQuery.data.Items : [], [coursesQuery.data, coursesQuery.isSuccess]);
|
|
100
|
+
const selectedMembers = (0, _react.useMemo)(() => membersQuery.isSuccess && Array.isArray(membersQuery.data.Items) && membersQuery.data.Items.length ? membersQuery.data.Items : [], [membersQuery.data, membersQuery.isSuccess]);
|
|
101
|
+
const classroomMembers = async selectedMembers => {
|
|
102
|
+
const formattedMembers = await getMemberDetails(selectedMembers);
|
|
103
|
+
setMembers(formattedMembers);
|
|
104
|
+
};
|
|
105
|
+
(0, _react.useEffect)(() => {
|
|
106
|
+
classroomMembers(selectedMembers);
|
|
107
|
+
}, [selectedMembers]);
|
|
108
|
+
(0, _react.useEffect)(() => {
|
|
109
|
+
setAssignment(prev => ({
|
|
110
|
+
...prev,
|
|
111
|
+
exercises: selectedExercises
|
|
112
|
+
}));
|
|
113
|
+
}, [selectedExercises]);
|
|
114
|
+
(0, _react.useEffect)(() => {
|
|
115
|
+
setAssignment(prev => ({
|
|
116
|
+
...prev,
|
|
117
|
+
assignedStudents: members?.map(member => member.memberId)
|
|
118
|
+
}));
|
|
119
|
+
}, [members]);
|
|
120
|
+
(0, _react.useEffect)(() => {
|
|
121
|
+
setAssignment(prev => ({
|
|
122
|
+
...prev,
|
|
123
|
+
classroomId: classroom
|
|
124
|
+
}));
|
|
125
|
+
}, [classroom]);
|
|
126
|
+
const [isSelectExerciseOpen, setIsSelectExerciseOpen] = (0, _react.useState)(false);
|
|
127
|
+
const handleCloseSelectExercise = () => {
|
|
128
|
+
setIsSelectExerciseOpen(false);
|
|
129
|
+
};
|
|
56
130
|
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
|
57
131
|
const handleMenuOpen = event => {
|
|
58
132
|
setAnchorEl(event.currentTarget);
|
|
@@ -63,17 +137,17 @@ function CreateAssignmentScreen({
|
|
|
63
137
|
const handleChange = field => event => {
|
|
64
138
|
let value = event?.target?.value ?? event;
|
|
65
139
|
setAssignment(prev => {
|
|
66
|
-
if (field === "
|
|
140
|
+
if (field === "assignedStudents") {
|
|
67
141
|
return {
|
|
68
142
|
...prev,
|
|
69
|
-
|
|
143
|
+
assignedStudents: typeof value === "string" ? value.split(",") : value
|
|
70
144
|
};
|
|
71
145
|
}
|
|
72
146
|
if (field === "classroom") {
|
|
73
147
|
return {
|
|
74
148
|
...prev,
|
|
75
|
-
|
|
76
|
-
|
|
149
|
+
classroomId: value,
|
|
150
|
+
assignedStudents: []
|
|
77
151
|
};
|
|
78
152
|
}
|
|
79
153
|
return {
|
|
@@ -82,8 +156,10 @@ function CreateAssignmentScreen({
|
|
|
82
156
|
};
|
|
83
157
|
});
|
|
84
158
|
};
|
|
85
|
-
const
|
|
86
|
-
|
|
159
|
+
const handleCreateAssignment = () => {
|
|
160
|
+
createAssignment(assignment);
|
|
161
|
+
handleClose();
|
|
162
|
+
};
|
|
87
163
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
88
164
|
fullScreen: true,
|
|
89
165
|
open: open,
|
|
@@ -102,7 +178,6 @@ function CreateAssignmentScreen({
|
|
|
102
178
|
variant: "h5",
|
|
103
179
|
fontWeight: "bold",
|
|
104
180
|
textAlign: "center",
|
|
105
|
-
mb: 1,
|
|
106
181
|
children: t("create_assignment")
|
|
107
182
|
})]
|
|
108
183
|
})
|
|
@@ -129,30 +204,47 @@ function CreateAssignmentScreen({
|
|
|
129
204
|
variant: "outlined",
|
|
130
205
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
131
206
|
id: "classroom-label",
|
|
207
|
+
required: true,
|
|
132
208
|
children: t("select_classroom")
|
|
133
209
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
|
|
134
210
|
labelId: "classroom-label",
|
|
135
211
|
id: "classroom",
|
|
136
|
-
value: assignment.
|
|
212
|
+
value: assignment.classroomId,
|
|
137
213
|
label: t("select_classroom"),
|
|
138
|
-
onChange: handleChange("
|
|
214
|
+
onChange: handleChange("classroomId"),
|
|
215
|
+
required: true,
|
|
216
|
+
disabled: classroom,
|
|
139
217
|
children: classrooms.map(classroom => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
140
|
-
value: classroom.
|
|
141
|
-
children:
|
|
142
|
-
|
|
218
|
+
value: classroom.classroomId,
|
|
219
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
220
|
+
sx: {
|
|
221
|
+
display: "flex",
|
|
222
|
+
alignItems: "center",
|
|
223
|
+
gap: 0.5
|
|
224
|
+
},
|
|
225
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
226
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
227
|
+
src: classroom.picture
|
|
228
|
+
})
|
|
229
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
230
|
+
primary: classroom.classroomName
|
|
231
|
+
})]
|
|
232
|
+
})
|
|
233
|
+
}, classroom.classroomId))
|
|
143
234
|
})]
|
|
144
235
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
145
236
|
label: t("assignment_title"),
|
|
146
237
|
fullWidth: true,
|
|
147
238
|
value: assignment.title,
|
|
148
|
-
onChange: handleChange("title")
|
|
239
|
+
onChange: handleChange("title"),
|
|
240
|
+
required: true
|
|
149
241
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
150
242
|
label: t("assignment_description"),
|
|
151
243
|
fullWidth: true,
|
|
152
244
|
multiline: true,
|
|
153
245
|
rows: 3,
|
|
154
|
-
value: assignment.
|
|
155
|
-
onChange: handleChange("
|
|
246
|
+
value: assignment.instructions,
|
|
247
|
+
onChange: handleChange("instructions")
|
|
156
248
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
157
249
|
variant: "outlined",
|
|
158
250
|
color: "primary",
|
|
@@ -160,6 +252,7 @@ function CreateAssignmentScreen({
|
|
|
160
252
|
width: "fit-content"
|
|
161
253
|
},
|
|
162
254
|
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {}),
|
|
255
|
+
onClick: () => setIsSelectExerciseOpen(true),
|
|
163
256
|
children: t("add_exercise")
|
|
164
257
|
})]
|
|
165
258
|
})
|
|
@@ -180,31 +273,33 @@ function CreateAssignmentScreen({
|
|
|
180
273
|
},
|
|
181
274
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
182
275
|
fullWidth: true,
|
|
183
|
-
disabled: !assignment.
|
|
276
|
+
disabled: !assignment.classroomId,
|
|
184
277
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
185
|
-
id: "
|
|
186
|
-
|
|
278
|
+
id: "members-label",
|
|
279
|
+
required: true,
|
|
280
|
+
children: t("select_members")
|
|
187
281
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
|
|
188
|
-
labelId: "
|
|
189
|
-
id: "
|
|
190
|
-
label: t("
|
|
282
|
+
labelId: "members-label",
|
|
283
|
+
id: "assignedStudents",
|
|
284
|
+
label: t("select_members"),
|
|
191
285
|
multiple: true,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
286
|
+
required: true,
|
|
287
|
+
value: assignment.assignedStudents,
|
|
288
|
+
onChange: handleChange("assignedStudents"),
|
|
289
|
+
renderValue: selected => selected.map(memberId => members?.find(member => member.memberId === memberId)).map(member => member?.username).join(", "),
|
|
290
|
+
children: members?.map(member => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
291
|
+
value: member.memberId,
|
|
197
292
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
198
|
-
src:
|
|
293
|
+
src: member.userImage,
|
|
199
294
|
sx: {
|
|
200
295
|
mr: 2
|
|
201
296
|
}
|
|
202
297
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
203
|
-
primary:
|
|
298
|
+
primary: member.username
|
|
204
299
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
205
|
-
checked: assignment.
|
|
300
|
+
checked: assignment.assignedStudents?.includes(member.memberId)
|
|
206
301
|
})]
|
|
207
|
-
},
|
|
302
|
+
}, member.memberId))
|
|
208
303
|
})]
|
|
209
304
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalizationProvider.LocalizationProvider, {
|
|
210
305
|
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
@@ -236,6 +331,7 @@ function CreateAssignmentScreen({
|
|
|
236
331
|
sx: {
|
|
237
332
|
marginRight: 2
|
|
238
333
|
},
|
|
334
|
+
onClick: handleClose,
|
|
239
335
|
children: t("cancel")
|
|
240
336
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonGroup, {
|
|
241
337
|
variant: "contained",
|
|
@@ -244,7 +340,8 @@ function CreateAssignmentScreen({
|
|
|
244
340
|
borderRadius: 10
|
|
245
341
|
},
|
|
246
342
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
247
|
-
disabled: !assignment.
|
|
343
|
+
disabled: !assignment.assignedStudents?.length || !assignment.scheduleDate || !assignment.dueDate || !assignment.title || !assignment.classroomId || !assignment.exercises?.length,
|
|
344
|
+
onClick: handleCreateAssignment,
|
|
248
345
|
children: t("assign")
|
|
249
346
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
250
347
|
color: "primary",
|
|
@@ -253,7 +350,7 @@ function CreateAssignmentScreen({
|
|
|
253
350
|
minWidth: "40px",
|
|
254
351
|
padding: "6px"
|
|
255
352
|
},
|
|
256
|
-
disabled: !assignment.
|
|
353
|
+
disabled: !assignment.assignedStudents?.length || !assignment.scheduleDate || !assignment.dueDate || !assignment.title || !assignment.classroomId || !assignment.exercises?.length,
|
|
257
354
|
children: anchorEl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropUp.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropDown.default, {})
|
|
258
355
|
})]
|
|
259
356
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popover, {
|
|
@@ -278,21 +375,39 @@ function CreateAssignmentScreen({
|
|
|
278
375
|
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
279
376
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, {
|
|
280
377
|
label: t("assign_date"),
|
|
281
|
-
value: assignment.
|
|
378
|
+
value: assignment.scheduleDate,
|
|
282
379
|
onChange: date => setAssignment(prev => ({
|
|
283
380
|
...prev,
|
|
284
|
-
|
|
381
|
+
scheduleDate: date
|
|
285
382
|
}))
|
|
286
383
|
})
|
|
287
384
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
288
385
|
variant: "outlined",
|
|
289
386
|
color: "primary",
|
|
290
387
|
fullWidth: true,
|
|
388
|
+
onClick: () => {
|
|
389
|
+
handleCreateAssignment;
|
|
390
|
+
handleMenuClose();
|
|
391
|
+
},
|
|
291
392
|
children: t("schedule_assignment")
|
|
292
393
|
})]
|
|
293
394
|
})
|
|
294
395
|
})]
|
|
295
|
-
}),
|
|
396
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectExercise.default, {
|
|
397
|
+
t: t,
|
|
398
|
+
open: isSelectExerciseOpen,
|
|
399
|
+
handleClose: handleCloseSelectExercise,
|
|
400
|
+
courses: selectedCourses,
|
|
401
|
+
getCourseSections: getCourseSections,
|
|
402
|
+
getRoleplays: getRoleplays,
|
|
403
|
+
username: username,
|
|
404
|
+
useCase: "assignment",
|
|
405
|
+
selectedExercises: selectedExercises,
|
|
406
|
+
setSelectedExercises: setSelectedExercises,
|
|
407
|
+
isAssignment: true
|
|
408
|
+
}), selectedExercises?.map(exercise => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
409
|
+
children: [exercise.name ? exercise.name : exercise.game, " | ", exercise.courseSectionTopicId ? exercise.courseSectionTopicId : exercise.roleplayId]
|
|
410
|
+
}))]
|
|
296
411
|
});
|
|
297
412
|
}
|
|
298
413
|
CreateAssignmentScreen.propTypes = {
|
|
@@ -20,10 +20,12 @@ function SelectExercise({
|
|
|
20
20
|
getRoleplays,
|
|
21
21
|
handleCreateGame,
|
|
22
22
|
username,
|
|
23
|
-
useCase = "live"
|
|
23
|
+
useCase = "live",
|
|
24
|
+
selectedExercises = [],
|
|
25
|
+
setSelectedExercises,
|
|
26
|
+
isAssignment
|
|
24
27
|
}) {
|
|
25
28
|
const [isExerciseSelected, setIsExerciseSelected] = (0, _react.useState)(false);
|
|
26
|
-
const [selectedExercises, setSelectedExercises] = (0, _react.useState)([]);
|
|
27
29
|
const handleSelectExercise = (exercises = []) => {
|
|
28
30
|
setSelectedExercises(prevSelectedExercises => {
|
|
29
31
|
let updatedExercises = [...prevSelectedExercises];
|
|
@@ -39,12 +41,18 @@ function SelectExercise({
|
|
|
39
41
|
return updatedExercises;
|
|
40
42
|
});
|
|
41
43
|
};
|
|
44
|
+
const handleSubmitExercises = () => {
|
|
45
|
+
setSelectedExercises(selectedExercises);
|
|
46
|
+
handleClose();
|
|
47
|
+
};
|
|
42
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveDialog.default, {
|
|
43
49
|
open: open,
|
|
44
50
|
handleClose: handleClose,
|
|
45
51
|
dialogTitle: useCase === "live" ? t("play_live") : t("assignment"),
|
|
46
52
|
maxWidth: "md",
|
|
47
|
-
handleSubmit: useCase === "live" ? null : () => {
|
|
53
|
+
handleSubmit: useCase === "live" ? null : () => {
|
|
54
|
+
handleSubmitExercises();
|
|
55
|
+
},
|
|
48
56
|
submitText: useCase === "live" ? null : t("add_exercises"),
|
|
49
57
|
isSubmitDisabled: selectedExercises.length === 0,
|
|
50
58
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContentText, {
|
|
@@ -63,7 +71,8 @@ function SelectExercise({
|
|
|
63
71
|
isDialogOpen: open,
|
|
64
72
|
useCase: useCase,
|
|
65
73
|
selectedExercises: selectedExercises,
|
|
66
|
-
handleSelectExercise: useCase === "assignment" ? handleSelectExercise : null
|
|
74
|
+
handleSelectExercise: useCase === "assignment" ? handleSelectExercise : null,
|
|
75
|
+
isAssignment: isAssignment
|
|
67
76
|
})
|
|
68
77
|
})]
|
|
69
78
|
});
|
|
@@ -725,7 +725,7 @@ function Listener({
|
|
|
725
725
|
gutterBottom: true,
|
|
726
726
|
children: t("what_do_you_hear")
|
|
727
727
|
})
|
|
728
|
-
}), useWordBank && isWordBankEnabled
|
|
728
|
+
}), useWordBank && isWordBankEnabled ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
729
729
|
role: "application",
|
|
730
730
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
731
731
|
item: true,
|
|
@@ -855,7 +855,7 @@ function Listener({
|
|
|
855
855
|
autoComplete: "off",
|
|
856
856
|
characters: learnLangCharacters ? learnLangCharacters : null
|
|
857
857
|
})
|
|
858
|
-
}), isWordBankEnabled &&
|
|
858
|
+
}), isWordBankEnabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
859
859
|
item: true,
|
|
860
860
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
861
861
|
title: t("use_wordbank_if_stuck"),
|
|
@@ -931,7 +931,7 @@ function Listener({
|
|
|
931
931
|
exercise: exerciseName,
|
|
932
932
|
languageInformation: languageInformation,
|
|
933
933
|
nualaCelebratingImage: getNualaCelebratingImage()
|
|
934
|
-
}), useWordBank && isWordBankEnabled
|
|
934
|
+
}), useWordBank && isWordBankEnabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExerciseBottomBar.default, {
|
|
935
935
|
t: t,
|
|
936
936
|
listeningWords: listeningWords,
|
|
937
937
|
handleSubmit: () => handleContinue(false),
|
|
@@ -42,13 +42,15 @@ const AssignmentCardsList = ({
|
|
|
42
42
|
}), !isCreator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
43
43
|
sx: {
|
|
44
44
|
textAlign: "center",
|
|
45
|
-
mt: 2
|
|
45
|
+
mt: 2,
|
|
46
|
+
width: '70%'
|
|
46
47
|
},
|
|
47
48
|
children: t("no_assignments_description")
|
|
48
49
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
49
50
|
sx: {
|
|
50
51
|
textAlign: "center",
|
|
51
|
-
mt: 2
|
|
52
|
+
mt: 2,
|
|
53
|
+
width: '70%'
|
|
52
54
|
},
|
|
53
55
|
children: t("assignments_description")
|
|
54
56
|
}), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
@@ -111,7 +111,7 @@ function Exercise({
|
|
|
111
111
|
}), name.toLowerCase() === "roleplays" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
112
112
|
children: roleplaysOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})
|
|
113
113
|
}), (name.toLowerCase() === "listening" || name.toLowerCase() === "translation" || name.toLowerCase() === "pronunciation") && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
114
|
-
children: isAssignment ?
|
|
114
|
+
children: isAssignment ? useCase === "assignment" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
115
115
|
checked: isAssignmentExerciseSelected,
|
|
116
116
|
onClick: event => {
|
|
117
117
|
event.stopPropagation();
|
|
@@ -115,22 +115,6 @@ function Member(props) {
|
|
|
115
115
|
marginBottom: "8px"
|
|
116
116
|
},
|
|
117
117
|
children: t("heritage_speaker_desc")
|
|
118
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
119
|
-
style: {
|
|
120
|
-
marginLeft: "16px",
|
|
121
|
-
marginBottom: "8px",
|
|
122
|
-
paddingLeft: "0"
|
|
123
|
-
},
|
|
124
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
125
|
-
children: t("heritage_speaker_point_1")
|
|
126
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
127
|
-
children: t("heritage_speaker_point_2")
|
|
128
|
-
})]
|
|
129
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
130
|
-
style: {
|
|
131
|
-
fontSize: "12px"
|
|
132
|
-
},
|
|
133
|
-
children: t("freely_changed")
|
|
134
118
|
})]
|
|
135
119
|
})
|
|
136
120
|
}))(({
|
|
@@ -1067,6 +1067,24 @@ function Classroom({
|
|
|
1067
1067
|
tabIndex: tabs.findIndex(tab => tab.id === "Discuss"),
|
|
1068
1068
|
variant: "extended"
|
|
1069
1069
|
};
|
|
1070
|
+
const assignmentsFab = {
|
|
1071
|
+
color: "primary",
|
|
1072
|
+
loading,
|
|
1073
|
+
className: null,
|
|
1074
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {
|
|
1075
|
+
sx: {
|
|
1076
|
+
mr: 1
|
|
1077
|
+
}
|
|
1078
|
+
}),
|
|
1079
|
+
buttonText: t("create_assignment"),
|
|
1080
|
+
id: "assignments-fab",
|
|
1081
|
+
onClick: () => {
|
|
1082
|
+
handleCreateAssignment();
|
|
1083
|
+
},
|
|
1084
|
+
title: t("create_assignment"),
|
|
1085
|
+
tabIndex: tabs.findIndex(tab => tab.id === "Assignments"),
|
|
1086
|
+
variant: "extended"
|
|
1087
|
+
};
|
|
1070
1088
|
const fabs = [[{
|
|
1071
1089
|
color: "primary",
|
|
1072
1090
|
className: null,
|
|
@@ -1076,7 +1094,7 @@ function Classroom({
|
|
|
1076
1094
|
title: t("add_courses"),
|
|
1077
1095
|
tabIndex: tabs.findIndex(tab => tab.id === "Courses"),
|
|
1078
1096
|
variant: "circular"
|
|
1079
|
-
}, vchatFab]];
|
|
1097
|
+
}, vchatFab, assignmentsFab]];
|
|
1080
1098
|
let initialTabValue;
|
|
1081
1099
|
if (window.location.hash) {
|
|
1082
1100
|
const selectedTab = window.location.hash;
|
|
@@ -1490,7 +1490,7 @@ function useExerciseState({
|
|
|
1490
1490
|
setRoleplayMessages(updatedRoleplayMessages);
|
|
1491
1491
|
handleSaveRoleplayExerciseProgress(updatedRoleplayMessages, answerAttempts);
|
|
1492
1492
|
};
|
|
1493
|
-
const addBotMessage = (text, isMyMessage, playAudio, method = null, isErrorMsg = false) => {
|
|
1493
|
+
const addBotMessage = (text, isMyMessage, playAudio, method = null, isErrorMsg = false, finalTranscript) => {
|
|
1494
1494
|
if (!text) {
|
|
1495
1495
|
return;
|
|
1496
1496
|
}
|
|
@@ -1506,6 +1506,7 @@ function useExerciseState({
|
|
|
1506
1506
|
text,
|
|
1507
1507
|
datetime: new Date(),
|
|
1508
1508
|
method,
|
|
1509
|
+
isEdited: finalTranscript && text.trim() !== finalTranscript.trim() && method === 'text',
|
|
1509
1510
|
audioBlob: audioBlob && isMyMessage ? audioBlob : null,
|
|
1510
1511
|
audioURL: attemptAudioURL && isMyMessage ? attemptAudioURL : null,
|
|
1511
1512
|
checked: attemptAudioURL && isMyMessage && checked ? checked : null,
|
|
@@ -1522,7 +1523,8 @@ function useExerciseState({
|
|
|
1522
1523
|
const handleSubmitBotMessage = async () => {
|
|
1523
1524
|
try {
|
|
1524
1525
|
const method = `${finalTranscript || ""} ${interimTranscript || ""}`.trim() === botText.trim() ? "voice" : "text";
|
|
1525
|
-
addBotMessage(botText, true, false, method);
|
|
1526
|
+
addBotMessage(botText, true, false, method, false, finalTranscript);
|
|
1527
|
+
resetTranscript();
|
|
1526
1528
|
const body = {
|
|
1527
1529
|
message: botText,
|
|
1528
1530
|
vars: botVars
|
|
@@ -154,12 +154,22 @@ function useRecognition(props = {}) {
|
|
|
154
154
|
*/
|
|
155
155
|
const initRecording = async (gcloudParams, onData, onError) => {
|
|
156
156
|
try {
|
|
157
|
+
const {
|
|
158
|
+
mediaDevices
|
|
159
|
+
} = navigator;
|
|
160
|
+
const [availableMicrophones, activeMicrophone, sampleRate] = await (0, _index.getMicrophoneInfo)(mediaDevices);
|
|
157
161
|
await setupAudioContext();
|
|
162
|
+
let sampleRateToUse = sampleRate;
|
|
163
|
+
if (sampleRate && sampleRate < 8000) {
|
|
164
|
+
sampleRateToUse = 8000;
|
|
165
|
+
} else if (sampleRate && sampleRate > 48000) {
|
|
166
|
+
sampleRateToUse = 48000;
|
|
167
|
+
}
|
|
158
168
|
const handleSuccess = function (stream) {
|
|
159
169
|
const gcloudConfig = {
|
|
160
170
|
config: {
|
|
161
171
|
encoding: "LINEAR16",
|
|
162
|
-
sampleRateHertz: 16000,
|
|
172
|
+
sampleRateHertz: sampleRateToUse || 16000,
|
|
163
173
|
languageCode: gcloudParams.languageCode || "en-US",
|
|
164
174
|
profanityFilter: true,
|
|
165
175
|
enableWordTimeOffsets: false,
|
|
@@ -172,7 +182,6 @@ function useRecognition(props = {}) {
|
|
|
172
182
|
interimResults: gcloudParams.interimResults // If you want interim results, set this to true
|
|
173
183
|
};
|
|
174
184
|
socket.emit("startGoogleCloudStream", gcloudConfig, version); // init socket Google Speech Connection
|
|
175
|
-
|
|
176
185
|
streamRef.current = stream;
|
|
177
186
|
audioInputRef.current = audioContextRef.current.createMediaStreamSource(stream);
|
|
178
187
|
serverErrorRef.current = null;
|
package/dist/utils/index.js
CHANGED
|
@@ -454,7 +454,12 @@ const getMicrophoneInfo = async mediaDevices => {
|
|
|
454
454
|
const availableMicrophoneNames = microphones?.filter(device => device.deviceId !== "default").map(device => device.label).join(", ") || "No available microphones detected";
|
|
455
455
|
const activeMicrophone = microphones?.length > 0 ? microphones.find(mic => mic.deviceId === "default") || microphones[0] : null;
|
|
456
456
|
const activeMicrophoneName = activeMicrophone?.label.split("Default - ").pop() || "No active microphone detected";
|
|
457
|
-
|
|
457
|
+
|
|
458
|
+
// Create an AudioContext with the stream from the active microphone
|
|
459
|
+
|
|
460
|
+
const capabilities = activeMicrophone.getCapabilities();
|
|
461
|
+
let sampleRate = capabilities?.sampleRate?.max || capabilities?.sampleRate?.exact;
|
|
462
|
+
return [availableMicrophoneNames, activeMicrophoneName, sampleRate];
|
|
458
463
|
} catch (error) {
|
|
459
464
|
console.error("Error accessing the microphone:", error);
|
|
460
465
|
}
|