@nualang/nualang-ui-components 0.1.1216 → 0.1.1218
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/Cards/Assignment/Assignment.js +13 -2
- package/dist/Chat/Messages/Message/Message.js +66 -16
- package/dist/Dialogs/CreateAssignmentScreen/CreateAssignmentScreen.js +2 -2
- package/dist/Exercises/Listener/Listener.js +3 -3
- package/dist/Lists/AssignmentCardsList/AssignmentCardsList.js +4 -2
- package/dist/Lists/Members/Members.js +0 -16
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +3 -1
- package/dist/hooks/useExerciseState.js +4 -2
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess
|
|
|
12
12
|
var _material = require("@mui/material");
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _AssignmentExerciseSelector = _interopRequireDefault(require("../../Misc/AssignmentExerciseSelector/AssignmentExerciseSelector"));
|
|
15
|
+
var _useConfirm = _interopRequireDefault(require("../../hooks/useConfirm"));
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
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); }
|
|
@@ -23,10 +24,11 @@ function Assignment({
|
|
|
23
24
|
username,
|
|
24
25
|
getCourseSections,
|
|
25
26
|
getRoleplays,
|
|
26
|
-
isCreator
|
|
27
|
+
isCreator,
|
|
28
|
+
deleteAssignment
|
|
27
29
|
}) {
|
|
28
|
-
t = text => text;
|
|
29
30
|
const [expanded, setExpanded] = (0, _react.useState)(false);
|
|
31
|
+
const [confirm] = (0, _useConfirm.default)(t);
|
|
30
32
|
const calculateDaysUntilDue = dueDate => {
|
|
31
33
|
const now = new Date();
|
|
32
34
|
const due = new Date(dueDate);
|
|
@@ -46,6 +48,12 @@ function Assignment({
|
|
|
46
48
|
event.stopPropagation();
|
|
47
49
|
setExpanded(prev => !prev);
|
|
48
50
|
};
|
|
51
|
+
const handleDeleteAssignment = async (classroomId, assignmentId) => {
|
|
52
|
+
const confirmed = await confirm(t('delete_assignment'), t('delete_assignment_confirmation'));
|
|
53
|
+
if (confirmed) {
|
|
54
|
+
await deleteAssignment(classroomId, assignmentId);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
49
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Card, {
|
|
50
58
|
sx: {
|
|
51
59
|
display: "flex",
|
|
@@ -109,6 +117,9 @@ function Assignment({
|
|
|
109
117
|
children: t("edit")
|
|
110
118
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
111
119
|
color: "primary",
|
|
120
|
+
onClick: () => {
|
|
121
|
+
handleDeleteAssignment(assignment.classroomId, assignment.assignmentId);
|
|
122
|
+
},
|
|
112
123
|
children: t("delete")
|
|
113
124
|
})]
|
|
114
125
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
@@ -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,
|
|
@@ -156,8 +156,8 @@ function CreateAssignmentScreen({
|
|
|
156
156
|
};
|
|
157
157
|
});
|
|
158
158
|
};
|
|
159
|
-
const handleCreateAssignment = () => {
|
|
160
|
-
createAssignment(assignment);
|
|
159
|
+
const handleCreateAssignment = async () => {
|
|
160
|
+
await createAssignment(assignment);
|
|
161
161
|
handleClose();
|
|
162
162
|
};
|
|
163
163
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
@@ -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),
|
|
@@ -18,7 +18,8 @@ const AssignmentCardsList = ({
|
|
|
18
18
|
assignments = [],
|
|
19
19
|
isCreator,
|
|
20
20
|
onRefresh,
|
|
21
|
-
handleCreateAssignment
|
|
21
|
+
handleCreateAssignment,
|
|
22
|
+
deleteAssignment
|
|
22
23
|
}) => {
|
|
23
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
24
25
|
mt: 3,
|
|
@@ -104,7 +105,8 @@ const AssignmentCardsList = ({
|
|
|
104
105
|
}), assignments.map(assignment => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Assignment.default, {
|
|
105
106
|
assignment: assignment,
|
|
106
107
|
t: t,
|
|
107
|
-
isCreator: isCreator
|
|
108
|
+
isCreator: isCreator,
|
|
109
|
+
deleteAssignment: deleteAssignment
|
|
108
110
|
}, assignment.id))]
|
|
109
111
|
})
|
|
110
112
|
});
|
|
@@ -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
|
}))(({
|
|
@@ -390,6 +390,7 @@ function Classroom({
|
|
|
390
390
|
featureFlags,
|
|
391
391
|
assignments,
|
|
392
392
|
handleCreateAssignment,
|
|
393
|
+
deleteAssignment,
|
|
393
394
|
...otherProps
|
|
394
395
|
}) {
|
|
395
396
|
const {
|
|
@@ -865,7 +866,8 @@ function Classroom({
|
|
|
865
866
|
memberId: !isCreator && username,
|
|
866
867
|
username: username,
|
|
867
868
|
getCourseSections: getCourseSections,
|
|
868
|
-
handleCreateAssignment: handleCreateAssignment
|
|
869
|
+
handleCreateAssignment: handleCreateAssignment,
|
|
870
|
+
deleteAssignment: deleteAssignment
|
|
869
871
|
})
|
|
870
872
|
}, `tab-content-assignments`)
|
|
871
873
|
}] : []), ...(isVideoChatEnabled && isNualangLiveEnabled && (isMember && isVideoChatEnabledInSettings || isCreator) ? [{
|
|
@@ -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
|