@nualang/nualang-ui-components 0.1.1216 → 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.
|
@@ -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,
|
|
@@ -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),
|
|
@@ -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
|
}))(({
|
|
@@ -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
|