@nualang/nualang-ui-components 0.1.1264 → 0.1.1266
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/AssignmentBotSelection/AssignmentBotSelection.js +28 -4
- package/dist/Assignments/AssignmentCourseSelection/AssignmentCourseSelection.js +11 -3
- package/dist/Assignments/AssignmentExerciseSelection/AssignmentExerciseSelection.js +71 -11
- package/dist/Assignments/AssignmentExerciseSelector/AssignmentExerciseSelector.js +6 -2
- package/dist/Assignments/AssignmentRoleplaySelection/AssignmentRoleplaySelection.js +37 -3
- package/dist/Assignments/CreateAssignmentDialog/CreateAssignmentDialog.js +7 -1
- package/dist/Dialogs/CreatePhrase/CreatePhrase.js +1 -1
- package/dist/Dialogs/GenerateBot/GenerateBot.js +1 -1
- package/dist/Dialogs/GeneratePhrases/GeneratePhrases.js +1 -1
- package/dist/Dialogs/GenerateQuestion/GenerateQuestion.js +1 -1
- package/dist/Dialogs/GenerateRoleplay/GenerateRoleplay.js +2 -2
- package/dist/Lists/Leaderboard/Leaderboard.js +16 -17
- package/dist/hooks/useExerciseState.js +1 -1
- package/package.json +1 -1
|
@@ -8,9 +8,11 @@ exports.ProgressBadge = ProgressBadge;
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _material = require("@mui/material");
|
|
11
|
+
var _Clear = _interopRequireDefault(require("@mui/icons-material/Clear"));
|
|
11
12
|
var _iconsMaterial = require("@mui/icons-material");
|
|
12
13
|
var _reactRouterDom = require("react-router-dom");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
16
|
const sxGreenColor = theme => ({
|
|
15
17
|
color: theme.palette.success ? theme.palette.success.dark : ""
|
|
16
18
|
});
|
|
@@ -49,7 +51,9 @@ function Bot({
|
|
|
49
51
|
lastClickedExerciseId,
|
|
50
52
|
memberCourseCompletions,
|
|
51
53
|
topicProgress,
|
|
52
|
-
isCreator
|
|
54
|
+
isCreator,
|
|
55
|
+
handleRemoveExercise,
|
|
56
|
+
isPreview
|
|
53
57
|
}) {
|
|
54
58
|
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
55
59
|
const params = (0, _reactRouterDom.useParams)();
|
|
@@ -137,6 +141,21 @@ function Bot({
|
|
|
137
141
|
e.stopPropagation();
|
|
138
142
|
handleClick();
|
|
139
143
|
}
|
|
144
|
+
}), useCase === "assignment-view" && isPreview && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
145
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
146
|
+
edge: "end",
|
|
147
|
+
"aria-label": "remove-bot",
|
|
148
|
+
onClick: e => {
|
|
149
|
+
e.stopPropagation();
|
|
150
|
+
const exerciseToRemove = selectedExercises.find(ex => ex.botId === bot.botId && ex.courseSectionTopicId === courseSectionTopicId);
|
|
151
|
+
if (exerciseToRemove) {
|
|
152
|
+
handleRemoveExercise(exerciseToRemove);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Clear.default, {
|
|
156
|
+
fontSize: "small"
|
|
157
|
+
})
|
|
158
|
+
})
|
|
140
159
|
}), useCase === "assignment-start" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemIcon, {
|
|
141
160
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(InProgressBadge, {
|
|
142
161
|
progressCount: getBotProgress()
|
|
@@ -159,9 +178,12 @@ function AssignmentBotSelection({
|
|
|
159
178
|
assignment,
|
|
160
179
|
lastClickedExerciseId,
|
|
161
180
|
memberCourseCompletions,
|
|
162
|
-
topicProgress
|
|
181
|
+
topicProgress,
|
|
182
|
+
handleRemoveExercise,
|
|
183
|
+
isPreview
|
|
163
184
|
}) {
|
|
164
|
-
|
|
185
|
+
const filteredBots = useCase === "assignment-view" ? bots.filter(bot => selectedExercises.some(ex => ex.botId === bot.botId && ex.courseSectionTopicId === courseSectionTopicId)) : bots;
|
|
186
|
+
return filteredBots.map((bot, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Bot, {
|
|
165
187
|
bot: bot,
|
|
166
188
|
courseSectionTopicId: courseSectionTopicId,
|
|
167
189
|
t: t,
|
|
@@ -172,7 +194,9 @@ function AssignmentBotSelection({
|
|
|
172
194
|
assignment: assignment,
|
|
173
195
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
174
196
|
memberCourseCompletions: memberCourseCompletions,
|
|
175
|
-
topicProgress: topicProgress
|
|
197
|
+
topicProgress: topicProgress,
|
|
198
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
199
|
+
isPreview: isPreview
|
|
176
200
|
}, index));
|
|
177
201
|
}
|
|
178
202
|
var _default = exports.default = AssignmentBotSelection;
|
|
@@ -35,7 +35,9 @@ function Course({
|
|
|
35
35
|
preferred_username,
|
|
36
36
|
progressHelpers,
|
|
37
37
|
memberCourseCompletions,
|
|
38
|
-
lastClickedExerciseId
|
|
38
|
+
lastClickedExerciseId,
|
|
39
|
+
handleRemoveExercise,
|
|
40
|
+
isPreview
|
|
39
41
|
}) {
|
|
40
42
|
const numOfIds = lastClickedExerciseId ? lastClickedExerciseId.split("|") : [];
|
|
41
43
|
const [open, setOpen] = (0, _react.useState)(lastClickedExerciseId && (numOfIds.length === 4 && lastClickedExerciseId.endsWith(`|${assignment.assignmentId}`) || numOfIds.length === 5 && lastClickedExerciseId.split("|")[3] === assignment.assignmentId));
|
|
@@ -198,7 +200,9 @@ function Course({
|
|
|
198
200
|
progressHelpers: progressHelpers,
|
|
199
201
|
memberCourseCompletions: memberCourseCompletions,
|
|
200
202
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
201
|
-
course: course
|
|
203
|
+
course: course,
|
|
204
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
205
|
+
isPreview: isPreview
|
|
202
206
|
})
|
|
203
207
|
})
|
|
204
208
|
});
|
|
@@ -223,6 +227,8 @@ function AssignmentCourseSelection({
|
|
|
223
227
|
progressHelpers,
|
|
224
228
|
memberCourseCompletions,
|
|
225
229
|
lastClickedExerciseId,
|
|
230
|
+
handleRemoveExercise,
|
|
231
|
+
isPreview,
|
|
226
232
|
...otherProps
|
|
227
233
|
}) {
|
|
228
234
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -246,7 +252,9 @@ function AssignmentCourseSelection({
|
|
|
246
252
|
preferred_username: preferred_username,
|
|
247
253
|
memberCourseCompletions: memberCourseCompletions,
|
|
248
254
|
progressHelpers: progressHelpers,
|
|
249
|
-
lastClickedExerciseId: lastClickedExerciseId
|
|
255
|
+
lastClickedExerciseId: lastClickedExerciseId,
|
|
256
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
257
|
+
isPreview: isPreview
|
|
250
258
|
}, course.courseId || index))
|
|
251
259
|
});
|
|
252
260
|
}
|
|
@@ -9,6 +9,7 @@ var _material = require("@mui/material");
|
|
|
9
9
|
var _styles = require("@mui/material/styles");
|
|
10
10
|
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
11
11
|
var _ImageSearch = _interopRequireDefault(require("@mui/icons-material/ImageSearch"));
|
|
12
|
+
var _Clear = _interopRequireDefault(require("@mui/icons-material/Clear"));
|
|
12
13
|
var _Hearing = _interopRequireDefault(require("@mui/icons-material/Hearing"));
|
|
13
14
|
var _SwapHoriz = _interopRequireDefault(require("@mui/icons-material/SwapHoriz"));
|
|
14
15
|
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
@@ -25,6 +26,7 @@ var _Exercises = require("../../Lists/Exercises/Exercises");
|
|
|
25
26
|
var _ColorLinearProgress = _interopRequireDefault(require("../../Misc/ColorLinearProgress/ColorLinearProgress"));
|
|
26
27
|
var _utils = require("../../utils");
|
|
27
28
|
var _AssignmentBotSelection = _interopRequireDefault(require("../AssignmentBotSelection/AssignmentBotSelection"));
|
|
29
|
+
var _iconsMaterial = require("@mui/icons-material");
|
|
28
30
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
31
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
32
|
function Exercise({
|
|
@@ -36,6 +38,8 @@ function Exercise({
|
|
|
36
38
|
isExerciseSelected,
|
|
37
39
|
roleplays,
|
|
38
40
|
bots,
|
|
41
|
+
roleplayId,
|
|
42
|
+
botId,
|
|
39
43
|
phrases,
|
|
40
44
|
handleSelectExercise = null,
|
|
41
45
|
selectedExercises,
|
|
@@ -48,7 +52,9 @@ function Exercise({
|
|
|
48
52
|
isCreator,
|
|
49
53
|
memberCourseCompletions,
|
|
50
54
|
completion,
|
|
51
|
-
lastClickedExerciseId
|
|
55
|
+
lastClickedExerciseId,
|
|
56
|
+
isPreview,
|
|
57
|
+
handleRemoveExercise = null
|
|
52
58
|
}) {
|
|
53
59
|
const [listeningHidden, setListeningHidden] = (0, _react.useState)(false);
|
|
54
60
|
const [translationHidden, setTranslationHidden] = (0, _react.useState)(false);
|
|
@@ -187,9 +193,9 @@ function Exercise({
|
|
|
187
193
|
primary: t(name),
|
|
188
194
|
secondary: t(description)
|
|
189
195
|
})
|
|
190
|
-
}), name.toLowerCase() === "roleplays" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.
|
|
196
|
+
}), name.toLowerCase() === "roleplays" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
191
197
|
children: roleplaysOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})
|
|
192
|
-
}), name.toLowerCase() === "bots" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.
|
|
198
|
+
}), name.toLowerCase() === "bots" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
193
199
|
children: botsOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})
|
|
194
200
|
}), (name.toLowerCase() === "listening" || name.toLowerCase() === "translation" || name.toLowerCase() === "pronunciation") && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemIcon, {
|
|
195
201
|
children: [useCase === "assignment-select" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
@@ -204,7 +210,20 @@ function Exercise({
|
|
|
204
210
|
courseSectionTopicId
|
|
205
211
|
}]);
|
|
206
212
|
}
|
|
207
|
-
}), useCase === "assignment-view" &&
|
|
213
|
+
}), useCase === "assignment-view" && isPreview && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
214
|
+
edge: "end",
|
|
215
|
+
"aria-label": "remove-exercise",
|
|
216
|
+
onClick: e => {
|
|
217
|
+
e.stopPropagation();
|
|
218
|
+
handleRemoveExercise({
|
|
219
|
+
courseSectionTopicId,
|
|
220
|
+
name
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Clear.default, {
|
|
224
|
+
fontSize: "small"
|
|
225
|
+
})
|
|
226
|
+
}), !isCreator && name.toLowerCase() === "pronunciation" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
208
227
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Exercises.InProgressBadge, {
|
|
209
228
|
progressCount: pronunciationProgress && pronunciationProgress.remainingQuestions?.length || 0
|
|
210
229
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Exercises.ProgressBadge, {
|
|
@@ -243,7 +262,9 @@ function Exercise({
|
|
|
243
262
|
memberCourseCompletions: memberCourseCompletions,
|
|
244
263
|
topicProgress: topicProgress,
|
|
245
264
|
isCreator: isCreator,
|
|
246
|
-
lastClickedExerciseId: lastClickedExerciseId
|
|
265
|
+
lastClickedExerciseId: lastClickedExerciseId,
|
|
266
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
267
|
+
isPreview: isPreview
|
|
247
268
|
})
|
|
248
269
|
})
|
|
249
270
|
}), name.toLowerCase() === "bots" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Collapse, {
|
|
@@ -265,7 +286,9 @@ function Exercise({
|
|
|
265
286
|
memberCourseCompletions: memberCourseCompletions,
|
|
266
287
|
topicProgress: topicProgress,
|
|
267
288
|
isCreator: isCreator,
|
|
268
|
-
lastClickedExerciseId: lastClickedExerciseId
|
|
289
|
+
lastClickedExerciseId: lastClickedExerciseId,
|
|
290
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
291
|
+
isPreview: isPreview
|
|
269
292
|
})
|
|
270
293
|
})
|
|
271
294
|
})]
|
|
@@ -297,6 +320,8 @@ function ExerciseList({
|
|
|
297
320
|
preferred_username,
|
|
298
321
|
lastClickedExerciseId,
|
|
299
322
|
completion,
|
|
323
|
+
handleRemoveExercise,
|
|
324
|
+
isPreview,
|
|
300
325
|
...otherProps
|
|
301
326
|
}) {
|
|
302
327
|
const courseSectionTopicId = `${courseId}|${sectionId}|${topicId}`;
|
|
@@ -332,6 +357,8 @@ function ExerciseList({
|
|
|
332
357
|
memberCourseCompletions: memberCourseCompletions,
|
|
333
358
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
334
359
|
completion: completion,
|
|
360
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
361
|
+
isPreview: isPreview,
|
|
335
362
|
...otherProps
|
|
336
363
|
}, keyId);
|
|
337
364
|
})
|
|
@@ -369,6 +396,8 @@ function Topic({
|
|
|
369
396
|
viewOnly,
|
|
370
397
|
getRoleplays,
|
|
371
398
|
getBots,
|
|
399
|
+
handleRemoveExercise,
|
|
400
|
+
isPreview,
|
|
372
401
|
...otherProps
|
|
373
402
|
}) {
|
|
374
403
|
const theme = (0, _styles.useTheme)();
|
|
@@ -617,7 +646,7 @@ function Topic({
|
|
|
617
646
|
fontWeight: "bold",
|
|
618
647
|
marginRight: 3
|
|
619
648
|
}
|
|
620
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.
|
|
649
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
621
650
|
children: isExerciseListOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})
|
|
622
651
|
}), useCase === "assignment-select" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
623
652
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
@@ -628,6 +657,17 @@ function Topic({
|
|
|
628
657
|
},
|
|
629
658
|
onChange: handleSelectAll
|
|
630
659
|
})
|
|
660
|
+
}), useCase === "assignment-view" && isPreview && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
661
|
+
edge: "end",
|
|
662
|
+
"aria-label": "remove-topic",
|
|
663
|
+
onClick: e => {
|
|
664
|
+
e.stopPropagation();
|
|
665
|
+
const topicExercises = selectedExercises.filter(ex => ex.courseSectionTopicId?.split("|")[2] === topicId);
|
|
666
|
+
handleRemoveExercise(topicExercises);
|
|
667
|
+
},
|
|
668
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Clear.default, {
|
|
669
|
+
fontSize: "small"
|
|
670
|
+
})
|
|
631
671
|
})]
|
|
632
672
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Collapse, {
|
|
633
673
|
in: isExerciseListOpen,
|
|
@@ -663,7 +703,9 @@ function Topic({
|
|
|
663
703
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
664
704
|
bots: bots,
|
|
665
705
|
...otherProps,
|
|
666
|
-
completion: completion
|
|
706
|
+
completion: completion,
|
|
707
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
708
|
+
isPreview: isPreview
|
|
667
709
|
})
|
|
668
710
|
})]
|
|
669
711
|
})
|
|
@@ -695,6 +737,8 @@ function Section({
|
|
|
695
737
|
lastClickedExerciseId,
|
|
696
738
|
completion,
|
|
697
739
|
course,
|
|
740
|
+
handleRemoveExercise,
|
|
741
|
+
isPreview,
|
|
698
742
|
...otherProps
|
|
699
743
|
}) {
|
|
700
744
|
const root = {
|
|
@@ -720,11 +764,15 @@ function Section({
|
|
|
720
764
|
}, [selectedExercises]);
|
|
721
765
|
(0, _react.useEffect)(() => {
|
|
722
766
|
if (viewOnly) {
|
|
723
|
-
setFilteredTopics(topics.filter(topic =>
|
|
767
|
+
setFilteredTopics(topics.filter(topic => {
|
|
768
|
+
const topicId = topic.topicId;
|
|
769
|
+
const hasExercises = assignment?.exercises?.some(e => e.courseSectionTopicId?.split("|")[2] === topicId);
|
|
770
|
+
return selectedTopicIds.includes(topicId) && hasExercises;
|
|
771
|
+
}));
|
|
724
772
|
}
|
|
725
|
-
}, [topics, selectedTopicIds, viewOnly]);
|
|
773
|
+
}, [topics, selectedTopicIds, viewOnly, assignment?.exercises]);
|
|
726
774
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
727
|
-
children: !isHidden && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.List, {
|
|
775
|
+
children: !isHidden && (viewOnly ? filteredTopics.length > 0 : topics.length > 0) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.List, {
|
|
728
776
|
subheader: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
729
777
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListSubheader, {
|
|
730
778
|
disableGutters: true,
|
|
@@ -766,6 +814,8 @@ function Section({
|
|
|
766
814
|
username: username,
|
|
767
815
|
preferred_username: preferred_username,
|
|
768
816
|
progressHelpers: progressHelpers,
|
|
817
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
818
|
+
isPreview: isPreview,
|
|
769
819
|
memberCourseCompletions: memberCourseCompletions
|
|
770
820
|
}, `${sectionId}-${topic.topicId}`)) : topics.map((topic, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Topic, {
|
|
771
821
|
viewOnly: viewOnly,
|
|
@@ -822,6 +872,8 @@ function SectionList({
|
|
|
822
872
|
memberCourseCompletions,
|
|
823
873
|
lastClickedExerciseId,
|
|
824
874
|
course,
|
|
875
|
+
handleRemoveExercise,
|
|
876
|
+
isPreview,
|
|
825
877
|
...otherProps
|
|
826
878
|
}) {
|
|
827
879
|
const [courseSectionWithProgress, setCourseSectionWithProgress] = (0, _react.useState)([]);
|
|
@@ -859,6 +911,8 @@ function SectionList({
|
|
|
859
911
|
memberCourseCompletions: memberCourseCompletions,
|
|
860
912
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
861
913
|
course: course,
|
|
914
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
915
|
+
isPreview: isPreview,
|
|
862
916
|
...otherProps
|
|
863
917
|
}, section.sectionId);
|
|
864
918
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
@@ -893,6 +947,8 @@ function AssignmentExerciseSelection({
|
|
|
893
947
|
memberCourseCompletions,
|
|
894
948
|
lastClickedExerciseId,
|
|
895
949
|
course,
|
|
950
|
+
handleRemoveExercise,
|
|
951
|
+
isPreview,
|
|
896
952
|
...otherProps
|
|
897
953
|
}) {
|
|
898
954
|
if (isLoading) {
|
|
@@ -920,6 +976,8 @@ function AssignmentExerciseSelection({
|
|
|
920
976
|
memberCourseCompletions: memberCourseCompletions,
|
|
921
977
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
922
978
|
course: course,
|
|
979
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
980
|
+
isPreview: isPreview,
|
|
923
981
|
...otherProps
|
|
924
982
|
})
|
|
925
983
|
});
|
|
@@ -948,6 +1006,8 @@ function AssignmentExerciseSelection({
|
|
|
948
1006
|
memberCourseCompletions: memberCourseCompletions,
|
|
949
1007
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
950
1008
|
course: course,
|
|
1009
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
1010
|
+
isPreview: isPreview,
|
|
951
1011
|
...otherProps
|
|
952
1012
|
})
|
|
953
1013
|
});
|
|
@@ -24,7 +24,9 @@ function AssignmentExerciseSelector({
|
|
|
24
24
|
preferred_username,
|
|
25
25
|
progressHelpers,
|
|
26
26
|
memberCourseCompletions,
|
|
27
|
-
lastClickedExerciseId
|
|
27
|
+
lastClickedExerciseId,
|
|
28
|
+
handleRemoveExercise,
|
|
29
|
+
isPreview
|
|
28
30
|
}) {
|
|
29
31
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Box, {
|
|
30
32
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCourseSelection.default, {
|
|
@@ -43,7 +45,9 @@ function AssignmentExerciseSelector({
|
|
|
43
45
|
preferred_username: preferred_username,
|
|
44
46
|
progressHelpers: progressHelpers,
|
|
45
47
|
memberCourseCompletions: memberCourseCompletions,
|
|
46
|
-
lastClickedExerciseId: lastClickedExerciseId
|
|
48
|
+
lastClickedExerciseId: lastClickedExerciseId,
|
|
49
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
50
|
+
isPreview: isPreview
|
|
47
51
|
})
|
|
48
52
|
});
|
|
49
53
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _material = require("@mui/material");
|
|
9
|
+
var _Clear = _interopRequireDefault(require("@mui/icons-material/Clear"));
|
|
9
10
|
var _Message = _interopRequireDefault(require("@mui/icons-material/Message"));
|
|
10
11
|
var _RateReview = _interopRequireDefault(require("@mui/icons-material/RateReview"));
|
|
11
12
|
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
@@ -91,7 +92,9 @@ function Roleplay({
|
|
|
91
92
|
assignment,
|
|
92
93
|
memberCourseCompletions,
|
|
93
94
|
topicProgress,
|
|
94
|
-
lastClickedExerciseId
|
|
95
|
+
lastClickedExerciseId,
|
|
96
|
+
handleRemoveExercise,
|
|
97
|
+
isPreview
|
|
95
98
|
}) {
|
|
96
99
|
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
97
100
|
const params = (0, _reactRouterDom.useParams)();
|
|
@@ -258,7 +261,7 @@ function Roleplay({
|
|
|
258
261
|
})
|
|
259
262
|
})
|
|
260
263
|
})]
|
|
261
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.
|
|
264
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
262
265
|
onClick: () => setOpen(!open),
|
|
263
266
|
children: open ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {
|
|
264
267
|
sx: {
|
|
@@ -269,6 +272,19 @@ function Roleplay({
|
|
|
269
272
|
color: "#757575"
|
|
270
273
|
}
|
|
271
274
|
})
|
|
275
|
+
}), useCase === "assignment-view" && isPreview && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
276
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
277
|
+
edge: "end",
|
|
278
|
+
"aria-label": "remove-roleplay",
|
|
279
|
+
onClick: e => {
|
|
280
|
+
e.stopPropagation();
|
|
281
|
+
const roleplayExercises = selectedExercises.filter(ex => ex.roleplayId === roleplay.roleplayId);
|
|
282
|
+
handleRemoveExercise(roleplayExercises);
|
|
283
|
+
},
|
|
284
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Clear.default, {
|
|
285
|
+
fontSize: "small"
|
|
286
|
+
})
|
|
287
|
+
})
|
|
272
288
|
}), useCase === "assignment-select" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
273
289
|
title: t("select_all"),
|
|
274
290
|
placement: "top",
|
|
@@ -349,6 +365,20 @@ function Roleplay({
|
|
|
349
365
|
t: t,
|
|
350
366
|
gameName: name
|
|
351
367
|
})]
|
|
368
|
+
}), useCase === "assignment-view" && isPreview && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
369
|
+
edge: "end",
|
|
370
|
+
"aria-label": "remove-roleplay-game",
|
|
371
|
+
onClick: e => {
|
|
372
|
+
e.stopPropagation();
|
|
373
|
+
handleRemoveExercise({
|
|
374
|
+
roleplayId: roleplay.roleplayId,
|
|
375
|
+
name,
|
|
376
|
+
courseSectionTopicId: roleplay.courseSectionTopicId
|
|
377
|
+
});
|
|
378
|
+
},
|
|
379
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Clear.default, {
|
|
380
|
+
fontSize: "small"
|
|
381
|
+
})
|
|
352
382
|
})]
|
|
353
383
|
})) : null]
|
|
354
384
|
})
|
|
@@ -369,6 +399,8 @@ function AssignmentRoleplaySelection({
|
|
|
369
399
|
topics,
|
|
370
400
|
isCreator,
|
|
371
401
|
lastClickedExerciseId,
|
|
402
|
+
handleRemoveExercise,
|
|
403
|
+
isPreview,
|
|
372
404
|
viewOnly
|
|
373
405
|
}) {
|
|
374
406
|
const [isRoleplaySelected, setIsRoleplaySelected] = (0, _react.useState)(false);
|
|
@@ -390,7 +422,9 @@ function AssignmentRoleplaySelection({
|
|
|
390
422
|
topicProgress: topicProgress,
|
|
391
423
|
topics: topics,
|
|
392
424
|
isCreator: isCreator,
|
|
393
|
-
lastClickedExerciseId: lastClickedExerciseId
|
|
425
|
+
lastClickedExerciseId: lastClickedExerciseId,
|
|
426
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
427
|
+
isPreview: isPreview
|
|
394
428
|
}, roleplay.roleplayId));
|
|
395
429
|
}
|
|
396
430
|
var _default = exports.default = AssignmentRoleplaySelection;
|
|
@@ -275,6 +275,10 @@ function CreateAssignmentDialog({
|
|
|
275
275
|
console.error("Error creating assignments:", error);
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
|
+
const handleRemoveExercise = toRemove => {
|
|
279
|
+
setSubmittedExercises(exs => exs.filter(e => !(Array.isArray(toRemove) ? toRemove.some(tr => tr.courseSectionTopicId === e.courseSectionTopicId && tr.name === e.name && tr.roleplayId === e.roleplayId && tr.botId === e.botId) : e.courseSectionTopicId === toRemove.courseSectionTopicId && e.name === toRemove.name && e.roleplayId === toRemove.roleplayId && e.botId === toRemove.botId)));
|
|
280
|
+
setSelectedExercises(exs => exs.filter(e => !(Array.isArray(toRemove) ? toRemove.some(tr => tr.courseSectionTopicId === e.courseSectionTopicId && tr.name === e.name && tr.roleplayId === e.roleplayId && tr.botId === e.botId) : e.courseSectionTopicId === toRemove.courseSectionTopicId && e.name === toRemove.name && e.roleplayId === toRemove.roleplayId && e.botId === toRemove.botId)));
|
|
281
|
+
};
|
|
278
282
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
279
283
|
fullScreen: true,
|
|
280
284
|
open: open,
|
|
@@ -432,7 +436,9 @@ function CreateAssignmentDialog({
|
|
|
432
436
|
getRoleplays: getRoleplays,
|
|
433
437
|
getBots: getBots,
|
|
434
438
|
viewOnly: true,
|
|
435
|
-
useCase: "assignment-view"
|
|
439
|
+
useCase: "assignment-view",
|
|
440
|
+
handleRemoveExercise: handleRemoveExercise,
|
|
441
|
+
isPreview: true
|
|
436
442
|
})]
|
|
437
443
|
})
|
|
438
444
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Card, {
|
|
@@ -238,7 +238,7 @@ function CreatePhrase({
|
|
|
238
238
|
const generateTranslations = async () => {
|
|
239
239
|
try {
|
|
240
240
|
let chatGptResponse = await makeChatGptApiRequest({
|
|
241
|
-
model: "gpt-4o
|
|
241
|
+
model: "gpt-4o",
|
|
242
242
|
promptKey: "generateTranslations",
|
|
243
243
|
promptVariables: {
|
|
244
244
|
learnLang,
|
|
@@ -166,7 +166,7 @@ function GenerateBotDialog({
|
|
|
166
166
|
setIsBotGenerating(true);
|
|
167
167
|
setErrorMessage("");
|
|
168
168
|
let chatGptResponse = await makeChatGptApiRequest({
|
|
169
|
-
model: "gpt-4o
|
|
169
|
+
model: "gpt-4o",
|
|
170
170
|
promptKey: "generateBot",
|
|
171
171
|
promptVariables: {
|
|
172
172
|
botTopic: values.botTopic,
|
|
@@ -146,7 +146,7 @@ function GeneratePhrases({
|
|
|
146
146
|
setIsGenerating(true);
|
|
147
147
|
setErrorMessage(null);
|
|
148
148
|
const chatGptResponse = await makeChatGptApiRequest({
|
|
149
|
-
model: "gpt-4o
|
|
149
|
+
model: "gpt-4o",
|
|
150
150
|
promptKey: "generatePhrases",
|
|
151
151
|
promptVariables: {
|
|
152
152
|
topicGoal: values.topicGoal,
|
|
@@ -211,7 +211,7 @@ function GenerateRoleplayDialog({
|
|
|
211
211
|
response = (0, _jsonrepair.jsonrepair)(text);
|
|
212
212
|
} else {
|
|
213
213
|
let chatGptResponse = await makeChatGptApiRequest({
|
|
214
|
-
model: "gpt-4o
|
|
214
|
+
model: "gpt-4o",
|
|
215
215
|
promptKey: "generateRoleplay",
|
|
216
216
|
promptVariables: {
|
|
217
217
|
learnLang: learnLang,
|
|
@@ -251,7 +251,7 @@ function GenerateRoleplayDialog({
|
|
|
251
251
|
if (endsSuspiciously) {
|
|
252
252
|
const continuationPrompt = `Continue the following in the same JSON format:\n\n${JSON.stringify(parsed.result, null, 2)}`;
|
|
253
253
|
const continuationResponse = await makeChatGptApiRequest({
|
|
254
|
-
model: "gpt-4o
|
|
254
|
+
model: "gpt-4o",
|
|
255
255
|
prompt: continuationPrompt
|
|
256
256
|
});
|
|
257
257
|
chatGptResponse = continuationResponse;
|
|
@@ -41,25 +41,24 @@ function Member(props) {
|
|
|
41
41
|
};
|
|
42
42
|
const [fadeKey, setFadeKey] = (0, _react.useState)(0);
|
|
43
43
|
const renderStreakIcon = () => {
|
|
44
|
-
if (
|
|
44
|
+
if (!lastThreeAnswerResults || lastThreeAnswerResults.length < 3) {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}));
|
|
47
|
+
|
|
48
|
+
// Ensure all three are strictly true
|
|
49
|
+
const isOnStreak = lastThreeAnswerResults.every(r => r === true);
|
|
50
|
+
if (isOnStreak && remainingQuestions.length > 1) {
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Fade.default, {
|
|
52
|
+
in: true,
|
|
53
|
+
timeout: 2000,
|
|
54
|
+
onExited: () => setFadeKey(prevKey => prevKey + 1),
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Whatshot.default, {
|
|
56
|
+
fontSize: "large",
|
|
57
|
+
sx: {
|
|
58
|
+
color: _colors.orange[500]
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
}, fadeKey);
|
|
63
62
|
}
|
|
64
63
|
return null;
|
|
65
64
|
};
|
|
@@ -1572,7 +1572,7 @@ function useExerciseState({
|
|
|
1572
1572
|
const body = {
|
|
1573
1573
|
message: botText,
|
|
1574
1574
|
vars: botVars,
|
|
1575
|
-
isFirstMessage: aiChatbotConversationHistory.length !== 0 ? false : isFirstMessage,
|
|
1575
|
+
isFirstMessage: Array.isArray(aiChatbotConversationHistory) && aiChatbotConversationHistory.length !== 0 ? false : isFirstMessage,
|
|
1576
1576
|
i18nLanguage,
|
|
1577
1577
|
isDynamicResponsesEnabled: isUserInternal ? isDynamicResponsesEnabled === "enable" ? true : false : false,
|
|
1578
1578
|
conversationHistory,
|