@nualang/nualang-ui-components 0.1.1384 → 0.1.1385
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/CreateAssignmentDialog/CreateAssignmentDialog.js +3 -2
- package/dist/Editors/PhraseList/PhraseList.js +2 -2
- package/dist/Editors/Phrases/Phrases.js +7 -8
- package/dist/Exercises/PhraseGroup/PhraseGroup.js +14 -2
- package/dist/Lists/Phrases/Phrases.js +2 -5
- package/package.json +1 -1
|
@@ -281,9 +281,10 @@ export default function CreateAssignmentDialog({
|
|
|
281
281
|
setIsCreating(false);
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
|
+
const matchesExercise = (a, b) => a.courseSectionTopicId === b.courseSectionTopicId && a.name === b.name && a.roleplayId === b.roleplayId && a.botId === b.botId && a.phraseListId === b.phraseListId;
|
|
284
285
|
const handleRemoveExercise = toRemove => {
|
|
285
|
-
setSubmittedExercises(exs => exs.filter(e => !(Array.isArray(toRemove) ? toRemove.some(tr => tr
|
|
286
|
-
setSelectedExercises(exs => exs.filter(e => !(Array.isArray(toRemove) ? toRemove.some(tr => tr
|
|
286
|
+
setSubmittedExercises(exs => exs.filter(e => !(Array.isArray(toRemove) ? toRemove.some(tr => matchesExercise(tr, e)) : matchesExercise(toRemove, e))));
|
|
287
|
+
setSelectedExercises(exs => exs.filter(e => !(Array.isArray(toRemove) ? toRemove.some(tr => matchesExercise(tr, e)) : matchesExercise(toRemove, e))));
|
|
287
288
|
};
|
|
288
289
|
return /*#__PURE__*/_jsxs(Dialog, {
|
|
289
290
|
fullScreen: true,
|
|
@@ -72,7 +72,7 @@ function PhraseList({
|
|
|
72
72
|
phrases,
|
|
73
73
|
isCreator,
|
|
74
74
|
isMember,
|
|
75
|
-
|
|
75
|
+
handleRemovePhrases,
|
|
76
76
|
uploadAudio,
|
|
77
77
|
updatePhrase,
|
|
78
78
|
forLangCharacters,
|
|
@@ -322,7 +322,7 @@ function PhraseList({
|
|
|
322
322
|
isMember: isMember,
|
|
323
323
|
handleTranslate: handleTranslate,
|
|
324
324
|
handleUpdatePhrase: updatePhrase,
|
|
325
|
-
|
|
325
|
+
handleRemovePhrases: handleRemovePhrases,
|
|
326
326
|
uploadAudio: uploadAudio,
|
|
327
327
|
handleSpeak: handleSpeak,
|
|
328
328
|
updatePhrases: updatePhrases,
|
|
@@ -78,7 +78,7 @@ const NormalModeComponent = ({
|
|
|
78
78
|
isMember,
|
|
79
79
|
handleTranslate,
|
|
80
80
|
handleUpdatePhrase,
|
|
81
|
-
|
|
81
|
+
handleRemovePhrases,
|
|
82
82
|
uploadAudio,
|
|
83
83
|
handleSpeak,
|
|
84
84
|
updatePhrases,
|
|
@@ -111,7 +111,7 @@ const NormalModeComponent = ({
|
|
|
111
111
|
handleTranslate: handleTranslate,
|
|
112
112
|
makeChatGptApiRequest: makeChatGptApiRequest,
|
|
113
113
|
handleUpdatePhrase: handleUpdatePhrase,
|
|
114
|
-
|
|
114
|
+
handleRemovePhrases: handleRemovePhrases,
|
|
115
115
|
uploadAudio: uploadAudio,
|
|
116
116
|
handleSpeak: handleSpeak,
|
|
117
117
|
updatePhrases: updatePhrases,
|
|
@@ -154,7 +154,7 @@ const CreatorComponent = ({
|
|
|
154
154
|
isMember,
|
|
155
155
|
handleTranslate,
|
|
156
156
|
handleUpdatePhrase,
|
|
157
|
-
|
|
157
|
+
handleRemovePhrases,
|
|
158
158
|
uploadAudio,
|
|
159
159
|
handleSpeak,
|
|
160
160
|
updatePhrases,
|
|
@@ -185,7 +185,7 @@ const CreatorComponent = ({
|
|
|
185
185
|
handleTranslate: handleTranslate,
|
|
186
186
|
makeChatGptApiRequest: makeChatGptApiRequest,
|
|
187
187
|
handleUpdatePhrase: handleUpdatePhrase,
|
|
188
|
-
|
|
188
|
+
handleRemovePhrases: handleRemovePhrases,
|
|
189
189
|
uploadAudio: uploadAudio,
|
|
190
190
|
handleSpeak: handleSpeak,
|
|
191
191
|
updatePhrases: updatePhrases,
|
|
@@ -256,7 +256,7 @@ function PhrasesEditor(props) {
|
|
|
256
256
|
isCreator,
|
|
257
257
|
isMember,
|
|
258
258
|
handleUpdatePhrase,
|
|
259
|
-
|
|
259
|
+
handleRemovePhrases,
|
|
260
260
|
handleSpreadsheetSaveChanges,
|
|
261
261
|
uploadAudio,
|
|
262
262
|
handleSpeak,
|
|
@@ -469,7 +469,7 @@ function PhrasesEditor(props) {
|
|
|
469
469
|
handleTranslate: handleTranslate,
|
|
470
470
|
makeChatGptApiRequest: makeChatGptApiRequest,
|
|
471
471
|
handleUpdatePhrase: handleUpdatePhrase,
|
|
472
|
-
|
|
472
|
+
handleRemovePhrases: handleRemovePhrases,
|
|
473
473
|
uploadAudio: uploadAudio,
|
|
474
474
|
handleSpeak: handleSpeak,
|
|
475
475
|
updatePhrases: updatePhrases,
|
|
@@ -502,7 +502,7 @@ function PhrasesEditor(props) {
|
|
|
502
502
|
isMember: isMember,
|
|
503
503
|
handleTranslate: handleTranslate,
|
|
504
504
|
handleUpdatePhrase: handleUpdatePhrase,
|
|
505
|
-
|
|
505
|
+
handleRemovePhrases: handleRemovePhrases,
|
|
506
506
|
uploadAudio: uploadAudio,
|
|
507
507
|
handleSpeak: handleSpeak,
|
|
508
508
|
updatePhrases: updatePhrases,
|
|
@@ -594,7 +594,6 @@ PhrasesEditor.propTypes = {
|
|
|
594
594
|
handleAddPhrase: PropTypes.func,
|
|
595
595
|
fileSizeLimit: PropTypes.number,
|
|
596
596
|
updatePhrase: PropTypes.func,
|
|
597
|
-
handleRemovePhrase: PropTypes.func,
|
|
598
597
|
uploadAudio: PropTypes.func,
|
|
599
598
|
handleSpeak: PropTypes.func,
|
|
600
599
|
updatePhrases: PropTypes.func,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useEffect, useState, memo } from "react";
|
|
2
2
|
import { useLocation, useNavigate, useParams } from "react-router";
|
|
3
3
|
import { useTheme } from "@mui/material/styles";
|
|
4
|
-
import { Slide, Dialog, Box, Divider } from "@mui/material";
|
|
4
|
+
import { Slide, Dialog, Box, Divider, Tooltip, IconButton } from "@mui/material";
|
|
5
|
+
import Create from "@mui/icons-material/Create";
|
|
5
6
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
6
7
|
import TopBar from "../../Chat/TopBar/TopBar";
|
|
7
8
|
import PhraseGroupInfo from "./PhraseGroupInfo/PhraseGroupInfo";
|
|
@@ -56,6 +57,7 @@ function PhraseGroup({
|
|
|
56
57
|
trackRecommendedEvent,
|
|
57
58
|
hiddenWordBankExercises,
|
|
58
59
|
isCreator,
|
|
60
|
+
handleEditPhraseGroup,
|
|
59
61
|
handleTogglePhraseGroupGameVisibility,
|
|
60
62
|
handleTogglePhraseGroupKeyboard,
|
|
61
63
|
handleTogglePhraseGroupWordBank,
|
|
@@ -170,6 +172,15 @@ function PhraseGroup({
|
|
|
170
172
|
assignment,
|
|
171
173
|
phraseListId: phraseGroup?.phraseGroupId
|
|
172
174
|
};
|
|
175
|
+
const topBarActions = isCreator && handleEditPhraseGroup ? /*#__PURE__*/_jsx(Tooltip, {
|
|
176
|
+
title: t("edit"),
|
|
177
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
178
|
+
color: "inherit",
|
|
179
|
+
onClick: () => handleEditPhraseGroup(phraseGroup),
|
|
180
|
+
size: "large",
|
|
181
|
+
children: /*#__PURE__*/_jsx(Create, {})
|
|
182
|
+
})
|
|
183
|
+
}) : null;
|
|
173
184
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
174
185
|
children: [/*#__PURE__*/_jsx(Dialog, {
|
|
175
186
|
fullScreen: true,
|
|
@@ -190,7 +201,8 @@ function PhraseGroup({
|
|
|
190
201
|
t: t,
|
|
191
202
|
title: "",
|
|
192
203
|
handleClose: handleClose,
|
|
193
|
-
isPrimaryColor: true
|
|
204
|
+
isPrimaryColor: true,
|
|
205
|
+
topBarActions: topBarActions
|
|
194
206
|
}), /*#__PURE__*/_jsx(Box, {
|
|
195
207
|
sx: {
|
|
196
208
|
display: "flex",
|
|
@@ -436,7 +436,7 @@ function PhraseList({
|
|
|
436
436
|
disableActions,
|
|
437
437
|
disableDragAndDrop = false,
|
|
438
438
|
updatePhrases,
|
|
439
|
-
|
|
439
|
+
handleRemovePhrases,
|
|
440
440
|
otherPhraseLists,
|
|
441
441
|
otherPhraseListsLoading,
|
|
442
442
|
handleTransferPhrase,
|
|
@@ -494,9 +494,7 @@ function PhraseList({
|
|
|
494
494
|
const confirmed = await confirm(isMultiple ? t("delete_phrases") : t("delete_phrase"), isMultiple ? t("delete_phrases_confirmation") : t("delete_phrase_confirmation"));
|
|
495
495
|
if (confirmed) {
|
|
496
496
|
try {
|
|
497
|
-
|
|
498
|
-
await handleRemovePhrase(phraseId);
|
|
499
|
-
}
|
|
497
|
+
await handleRemovePhrases(phraseIds);
|
|
500
498
|
setSelectedPhrases([]);
|
|
501
499
|
} catch (error) {
|
|
502
500
|
console.error(error);
|
|
@@ -629,7 +627,6 @@ function PhraseList({
|
|
|
629
627
|
disableDragAndDrop: disableDragAndDrop,
|
|
630
628
|
selectedPhrases: selectedPhrases,
|
|
631
629
|
handleSelectPhrase: handleSelectPhrase,
|
|
632
|
-
handleRemovePhrase: handleRemovePhrase,
|
|
633
630
|
handleDeletePhrases: handleDeletePhrases,
|
|
634
631
|
renderHandle: renderHandle,
|
|
635
632
|
...otherProps
|