@nualang/nualang-ui-components 0.1.1256 → 0.1.1258
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/AssignmentExerciseSelection/AssignmentExerciseSelection.js +29 -10
- package/dist/Assignments/CreateAssignmentDialog/CreateAssignmentDialog.js +57 -8
- package/dist/Cards/CardElements/CardVisibility/CardVisibility.js +27 -6
- package/dist/Cards/Course/Course.js +39 -6
- package/dist/Dialogs/GeneratePhrases/GeneratePhrases.js +2 -2
- package/dist/Lists/Courses/Courses.js +3 -0
- package/dist/Misc/AnswerResult/AnswerResult.js +4 -1
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +18 -4
- package/dist/Tables/TrialUsers/TrialUsers.js +156 -0
- package/package.json +1 -1
|
@@ -19,7 +19,6 @@ var _OndemandVideo = _interopRequireDefault(require("@mui/icons-material/Ondeman
|
|
|
19
19
|
var _AssignmentRoleplaySelection = _interopRequireDefault(require("../AssignmentRoleplaySelection/AssignmentRoleplaySelection"));
|
|
20
20
|
var _CardElements = require("../../Cards/CardElements");
|
|
21
21
|
var _Progress = require("@nualang/nualang-api-and-queries/APIs/Progress");
|
|
22
|
-
var _mui = require("tss-react/mui");
|
|
23
22
|
var _Queries = require("@nualang/nualang-api-and-queries/Queries");
|
|
24
23
|
var _reactRouterDom = require("react-router-dom");
|
|
25
24
|
var _Exercises = require("../../Lists/Exercises/Exercises");
|
|
@@ -369,7 +368,7 @@ function Topic({
|
|
|
369
368
|
const theme = (0, _styles.useTheme)();
|
|
370
369
|
const isLargeScreen = (0, _useMediaQuery.default)(theme.breakpoints.up("sm"));
|
|
371
370
|
const topicRef = (0, _react.useRef)(null);
|
|
372
|
-
const [
|
|
371
|
+
const [lasClickedTopicId, lastClickedAssignmentId] = lastClickedExerciseId?.split("|") || [];
|
|
373
372
|
const [isExerciseListOpen, setExerciseListOpen] = (0, _react.useState)(lasClickedTopicId === topicId && lastClickedAssignmentId === assignment.assignmentId);
|
|
374
373
|
const [isWholeTopicSelected, setIsWholeTopicSelected] = (0, _react.useState)(false);
|
|
375
374
|
(0, _react.useEffect)(() => {
|
|
@@ -462,15 +461,16 @@ function Topic({
|
|
|
462
461
|
setIsWholeTopicSelected(totalSelected === totalExpected);
|
|
463
462
|
}, [selectedExercises, exercises, roleplays, bots, courseId, sectionId, topicId, games]);
|
|
464
463
|
const handleSelectAll = () => {
|
|
465
|
-
|
|
466
|
-
|
|
464
|
+
const isAllSelected = selectedCount === totalCount;
|
|
465
|
+
if (isAllSelected) {
|
|
466
|
+
const removeExercises = selectedExercises?.filter(exercise => exercise.courseSectionTopicId === courseSectionTopicId || exercise.roleplayId && roleplays?.some(r => r.roleplayId === exercise.roleplayId) || exercise.botId && bots?.some(b => b.botId === exercise.botId));
|
|
467
467
|
handleSelectExercise(removeExercises);
|
|
468
468
|
} else {
|
|
469
469
|
let exercisesToAdd = [];
|
|
470
470
|
exercises?.filter(e => e.name !== "roleplays").forEach(exercise => {
|
|
471
|
-
if (!selectedExercises?.some(e => e.courseSectionTopicId ===
|
|
471
|
+
if (!selectedExercises?.some(e => e.courseSectionTopicId === courseSectionTopicId && e.name === exercise.name)) {
|
|
472
472
|
exercisesToAdd.push({
|
|
473
|
-
courseSectionTopicId:
|
|
473
|
+
courseSectionTopicId: courseSectionTopicId,
|
|
474
474
|
name: exercise.name
|
|
475
475
|
});
|
|
476
476
|
}
|
|
@@ -480,8 +480,8 @@ function Topic({
|
|
|
480
480
|
if (!selectedExercises?.some(e => e.roleplayId === roleplay.roleplayId && e.name === name)) {
|
|
481
481
|
exercisesToAdd.push({
|
|
482
482
|
roleplayId: roleplay.roleplayId,
|
|
483
|
-
name
|
|
484
|
-
courseSectionTopicId:
|
|
483
|
+
name,
|
|
484
|
+
courseSectionTopicId: courseSectionTopicId,
|
|
485
485
|
roleplayName: roleplay.roleplayName
|
|
486
486
|
});
|
|
487
487
|
}
|
|
@@ -491,7 +491,7 @@ function Topic({
|
|
|
491
491
|
if (!selectedExercises?.some(e => e.botId === bot.botId)) {
|
|
492
492
|
exercisesToAdd.push({
|
|
493
493
|
botId: bot.botId,
|
|
494
|
-
courseSectionTopicId:
|
|
494
|
+
courseSectionTopicId: courseSectionTopicId
|
|
495
495
|
});
|
|
496
496
|
}
|
|
497
497
|
});
|
|
@@ -502,6 +502,16 @@ function Topic({
|
|
|
502
502
|
setExerciseListOpen(!isExerciseListOpen);
|
|
503
503
|
};
|
|
504
504
|
const hasNonEmptyRoleplay = roleplays?.some(roleplay => roleplay?.script?.length !== 0 && roleplay?.script?.some(line => line.text !== undefined));
|
|
505
|
+
const courseSectionTopicId = `${courseId}|${sectionId}|${topicId}`;
|
|
506
|
+
const selectedRegular = selectedExercises?.filter(e => e.courseSectionTopicId === courseSectionTopicId && !e.roleplayId && !e.botId && e.name !== "roleplays" && e.name !== "bots").length || 0;
|
|
507
|
+
const selectedRoleplays = selectedExercises?.filter(e => e.courseSectionTopicId === courseSectionTopicId && e.roleplayId).length || 0;
|
|
508
|
+
const selectedBots = selectedExercises?.filter(e => e.courseSectionTopicId === courseSectionTopicId && e.botId).length || 0;
|
|
509
|
+
const selectedCount = selectedRegular + selectedRoleplays + selectedBots;
|
|
510
|
+
const totalRegular = 3;
|
|
511
|
+
const totalRoleplays = (roleplays?.length || 0) * (games?.length || 0);
|
|
512
|
+
const totalBots = bots?.length || 0;
|
|
513
|
+
const totalCount = totalRegular + totalRoleplays + totalBots;
|
|
514
|
+
const isTopicDisabled = phrases.length === 0 && !hasNonEmptyRoleplay || isExerciseSelected;
|
|
505
515
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
506
516
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Tooltip, {
|
|
507
517
|
title: phrases.length === 0 ? t("topic_no_phrases") : "",
|
|
@@ -592,11 +602,20 @@ function Topic({
|
|
|
592
602
|
})]
|
|
593
603
|
})
|
|
594
604
|
})]
|
|
605
|
+
}), !isTopicDisabled && useCase === "assignment-select" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
|
|
606
|
+
label: `${selectedCount} / ${totalCount}`,
|
|
607
|
+
size: "medium",
|
|
608
|
+
disabled: selectedCount === 0,
|
|
609
|
+
color: selectedCount === totalCount ? 'primary' : 'default',
|
|
610
|
+
sx: {
|
|
611
|
+
fontWeight: 'bold',
|
|
612
|
+
marginRight: 3
|
|
613
|
+
}
|
|
595
614
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
596
615
|
children: isExerciseListOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})
|
|
597
616
|
}), useCase === "assignment-select" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
598
617
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
599
|
-
checked:
|
|
618
|
+
checked: selectedCount === totalCount,
|
|
600
619
|
onClick: event => {
|
|
601
620
|
event.stopPropagation();
|
|
602
621
|
},
|
|
@@ -318,7 +318,33 @@ function CreateAssignmentDialog({
|
|
|
318
318
|
label: t("select_classroom"),
|
|
319
319
|
onChange: handleChange("classroomId"),
|
|
320
320
|
required: true,
|
|
321
|
-
renderValue: selected =>
|
|
321
|
+
renderValue: selected => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
322
|
+
sx: {
|
|
323
|
+
display: "inline-block",
|
|
324
|
+
maxWidth: "100%",
|
|
325
|
+
whiteSpace: "nowrap",
|
|
326
|
+
overflow: "hidden",
|
|
327
|
+
textOverflow: "ellipsis"
|
|
328
|
+
},
|
|
329
|
+
children: selected?.map(classroomId => classrooms?.find(c => c.classroomId === classroomId))?.map(c => c?.classroomName)?.filter(n => n).join(", ")
|
|
330
|
+
}),
|
|
331
|
+
MenuProps: {
|
|
332
|
+
PaperProps: {
|
|
333
|
+
sx: {
|
|
334
|
+
width: 'auto',
|
|
335
|
+
maxWidth: 400
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
getContentAnchorEl: null,
|
|
339
|
+
anchorOrigin: {
|
|
340
|
+
vertical: "bottom",
|
|
341
|
+
horizontal: "left"
|
|
342
|
+
},
|
|
343
|
+
transformOrigin: {
|
|
344
|
+
vertical: "top",
|
|
345
|
+
horizontal: "left"
|
|
346
|
+
}
|
|
347
|
+
},
|
|
322
348
|
children: classrooms.filter(c => c.createdBy === username || c.collaborators.includes(userEmail)).map(c => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
323
349
|
value: c.classroomId,
|
|
324
350
|
disabled: c.classroomId === classroom,
|
|
@@ -326,14 +352,37 @@ function CreateAssignmentDialog({
|
|
|
326
352
|
sx: {
|
|
327
353
|
display: "flex",
|
|
328
354
|
alignItems: "center",
|
|
329
|
-
|
|
355
|
+
justifyContent: "space-between",
|
|
356
|
+
width: "100%"
|
|
330
357
|
},
|
|
331
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
358
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
359
|
+
sx: {
|
|
360
|
+
display: "flex",
|
|
361
|
+
alignItems: "center",
|
|
362
|
+
flex: 1,
|
|
363
|
+
minWidth: 0,
|
|
364
|
+
gap: 1
|
|
365
|
+
},
|
|
366
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
367
|
+
src: c.picture,
|
|
368
|
+
sx: {
|
|
369
|
+
width: 32,
|
|
370
|
+
height: 32
|
|
371
|
+
}
|
|
372
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
373
|
+
primary: c.classroomName,
|
|
374
|
+
primaryTypographyProps: {
|
|
375
|
+
noWrap: true,
|
|
376
|
+
sx: {
|
|
377
|
+
overflow: "hidden",
|
|
378
|
+
textOverflow: "ellipsis"
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
sx: {
|
|
382
|
+
minWidth: 0,
|
|
383
|
+
flex: 1
|
|
384
|
+
}
|
|
385
|
+
})]
|
|
337
386
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
338
387
|
disabled: c.classroomId === classroom,
|
|
339
388
|
checked: assignment.classroomId?.includes(c.classroomId) || c.classroomId === classroom
|
|
@@ -11,11 +11,13 @@ var _Public = _interopRequireDefault(require("@mui/icons-material/Public"));
|
|
|
11
11
|
var _VpnLock = _interopRequireDefault(require("@mui/icons-material/VpnLock"));
|
|
12
12
|
var _colors = require("@mui/material/colors");
|
|
13
13
|
var _Archive = _interopRequireDefault(require("@mui/icons-material/Archive"));
|
|
14
|
+
var _VisibilityOff = _interopRequireDefault(require("@mui/icons-material/VisibilityOff"));
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
17
|
function CardVisibility({
|
|
17
18
|
t = text => text,
|
|
18
|
-
visibility = ""
|
|
19
|
+
visibility = "",
|
|
20
|
+
isCourseHidden = false
|
|
19
21
|
}) {
|
|
20
22
|
const isPublic = visibility === "public";
|
|
21
23
|
let icon;
|
|
@@ -36,18 +38,18 @@ function CardVisibility({
|
|
|
36
38
|
});
|
|
37
39
|
color = "secondary";
|
|
38
40
|
}
|
|
39
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
40
42
|
sx: {
|
|
41
43
|
position: "relative"
|
|
42
44
|
},
|
|
43
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
|
|
45
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
|
|
44
46
|
color: color,
|
|
45
47
|
icon: icon,
|
|
46
48
|
label: t(visibility),
|
|
47
49
|
sx: theme => ({
|
|
48
50
|
position: "absolute",
|
|
49
|
-
bottom: "
|
|
50
|
-
right: "
|
|
51
|
+
bottom: "8px",
|
|
52
|
+
right: "8px",
|
|
51
53
|
fontWeight: "bold",
|
|
52
54
|
textTransform: "capitalize",
|
|
53
55
|
pointerEvents: "none",
|
|
@@ -57,7 +59,26 @@ function CardVisibility({
|
|
|
57
59
|
color: "white"
|
|
58
60
|
})
|
|
59
61
|
})
|
|
60
|
-
})
|
|
62
|
+
}), isCourseHidden && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
|
|
63
|
+
color: "success",
|
|
64
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_VisibilityOff.default, {
|
|
65
|
+
fontSize: "small"
|
|
66
|
+
}),
|
|
67
|
+
label: t("hidden"),
|
|
68
|
+
sx: theme => ({
|
|
69
|
+
position: "absolute",
|
|
70
|
+
bottom: "8px",
|
|
71
|
+
right: "108px",
|
|
72
|
+
fontWeight: "bold",
|
|
73
|
+
textTransform: "capitalize",
|
|
74
|
+
pointerEvents: "none",
|
|
75
|
+
boxShadow: theme.shadows[1],
|
|
76
|
+
backgroundColor: theme.palette.mode === "light" ? _colors.blue[700] : _colors.blue[500],
|
|
77
|
+
...(theme.palette.mode === "light" && {
|
|
78
|
+
color: "white"
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
})]
|
|
61
82
|
});
|
|
62
83
|
}
|
|
63
84
|
CardVisibility.propTypes = {
|
|
@@ -19,6 +19,8 @@ var _FileCopy = _interopRequireDefault(require("@mui/icons-material/FileCopy"));
|
|
|
19
19
|
var _OndemandVideo = _interopRequireDefault(require("@mui/icons-material/OndemandVideo"));
|
|
20
20
|
var _PictureAsPdf = _interopRequireDefault(require("@mui/icons-material/PictureAsPdf"));
|
|
21
21
|
var _School = _interopRequireDefault(require("@mui/icons-material/School"));
|
|
22
|
+
var _Visibility = _interopRequireDefault(require("@mui/icons-material/Visibility"));
|
|
23
|
+
var _VisibilityOff = _interopRequireDefault(require("@mui/icons-material/VisibilityOff"));
|
|
22
24
|
var _Members = _interopRequireDefault(require("../../Dialogs/Members"));
|
|
23
25
|
var _CourseOutline = _interopRequireDefault(require("../../Dialogs/CourseOutline"));
|
|
24
26
|
var _Members2 = _interopRequireDefault(require("../../Lists/Members"));
|
|
@@ -43,16 +45,19 @@ function OverflowMenu({
|
|
|
43
45
|
handleClickOpenMembers,
|
|
44
46
|
isCreator,
|
|
45
47
|
isMember,
|
|
46
|
-
viewCourse,
|
|
47
48
|
startCourse,
|
|
48
49
|
leaveCourse,
|
|
49
50
|
handleRemoveCourse,
|
|
51
|
+
handleHideCourse,
|
|
52
|
+
handleUnhideCourse,
|
|
50
53
|
isAdmin,
|
|
51
54
|
handleDuplicateCourse,
|
|
52
55
|
course,
|
|
53
56
|
classroomId,
|
|
54
57
|
isClassroomArchived = false,
|
|
55
|
-
canDuplicateCourse
|
|
58
|
+
canDuplicateCourse,
|
|
59
|
+
hiddenCourses = [],
|
|
60
|
+
isTeacher
|
|
56
61
|
}) {
|
|
57
62
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Menu, {
|
|
58
63
|
id: `card-menu-${courseId}`,
|
|
@@ -99,7 +104,7 @@ function OverflowMenu({
|
|
|
99
104
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
100
105
|
children: t("change_settings")
|
|
101
106
|
})]
|
|
102
|
-
}), !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
107
|
+
}), !isClassroomArchived && isTeacher && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
103
108
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
104
109
|
title: !canDuplicateCourse ? t("duplicate_disabled_tooltip") : "",
|
|
105
110
|
disableHoverListener: canDuplicateCourse,
|
|
@@ -129,6 +134,24 @@ function OverflowMenu({
|
|
|
129
134
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
130
135
|
children: t("remove_course")
|
|
131
136
|
})]
|
|
137
|
+
}), handleHideCourse && !hiddenCourses.includes(courseId) && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
138
|
+
onClick: () => handleHideCourse(courseId),
|
|
139
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
|
|
140
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_VisibilityOff.default, {
|
|
141
|
+
fontSize: "small"
|
|
142
|
+
})
|
|
143
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
144
|
+
children: t("hide_course")
|
|
145
|
+
})]
|
|
146
|
+
}), handleUnhideCourse && hiddenCourses.includes(courseId) && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
147
|
+
onClick: () => handleUnhideCourse(courseId),
|
|
148
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
|
|
149
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Visibility.default, {
|
|
150
|
+
fontSize: "small"
|
|
151
|
+
})
|
|
152
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
153
|
+
children: t("show_course")
|
|
154
|
+
})]
|
|
132
155
|
})]
|
|
133
156
|
});
|
|
134
157
|
}
|
|
@@ -199,6 +222,8 @@ function CourseCard({
|
|
|
199
222
|
handleLeaveCourse,
|
|
200
223
|
handleClickCourse,
|
|
201
224
|
handleRemoveCourse,
|
|
225
|
+
handleHideCourse,
|
|
226
|
+
handleUnhideCourse,
|
|
202
227
|
membersProps,
|
|
203
228
|
selectable,
|
|
204
229
|
selected,
|
|
@@ -218,13 +243,16 @@ function CourseCard({
|
|
|
218
243
|
classroomId,
|
|
219
244
|
cardTitleComponent = "h2",
|
|
220
245
|
isClassroomArchived = false,
|
|
221
|
-
email
|
|
246
|
+
email,
|
|
247
|
+
isTeacher,
|
|
248
|
+
hiddenCourses = []
|
|
222
249
|
}) {
|
|
223
250
|
const [placeholderRef, visible] = (0, _reactIntersectionObserver.useInView)({
|
|
224
251
|
rootMargin: "320px",
|
|
225
252
|
triggerOnce: true
|
|
226
253
|
});
|
|
227
254
|
const [isOutlineOpen, setIsOutlineOpen] = (0, _react.useState)(false);
|
|
255
|
+
const isCourseHidden = hiddenCourses.includes(course.courseId);
|
|
228
256
|
const sectionsQuery = _Queries.courses.useCourseSections(async (courseId, filters) => {
|
|
229
257
|
const response = await getCourseSections(courseId, filters);
|
|
230
258
|
return response;
|
|
@@ -346,7 +374,8 @@ function CourseCard({
|
|
|
346
374
|
placeholderRef: placeholderRef
|
|
347
375
|
}), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardVisibility, {
|
|
348
376
|
t: t,
|
|
349
|
-
visibility: visibility
|
|
377
|
+
visibility: visibility,
|
|
378
|
+
isCourseHidden: isCourseHidden
|
|
350
379
|
})]
|
|
351
380
|
}), userImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardAvatar, {
|
|
352
381
|
"aria-label": `${t("go_to")} ${createdByName || `${courseName} ${t("creator")}`} ${t("profile")}`,
|
|
@@ -535,10 +564,14 @@ function CourseCard({
|
|
|
535
564
|
startCourse: startCourse,
|
|
536
565
|
leaveCourse: leaveCourse,
|
|
537
566
|
handleRemoveCourse: handleRemoveCourse,
|
|
567
|
+
handleHideCourse: handleHideCourse,
|
|
568
|
+
handleUnhideCourse: handleUnhideCourse,
|
|
538
569
|
handleDuplicateCourse: handleDuplicateCourse,
|
|
539
570
|
course: course,
|
|
540
571
|
isClassroomArchived: isClassroomArchived,
|
|
541
|
-
canDuplicateCourse: canDuplicateCourse
|
|
572
|
+
canDuplicateCourse: canDuplicateCourse,
|
|
573
|
+
hiddenCourses: hiddenCourses,
|
|
574
|
+
isTeacher: isTeacher
|
|
542
575
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Members.default, {
|
|
543
576
|
getMemberDetails: getMemberDetails,
|
|
544
577
|
t: t,
|
|
@@ -180,11 +180,11 @@ function GeneratePhrases({
|
|
|
180
180
|
};
|
|
181
181
|
const handleCancel = () => {
|
|
182
182
|
setGeneratedPhrases([]);
|
|
183
|
-
handleClose();
|
|
184
183
|
};
|
|
185
184
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveDialog.default, {
|
|
186
185
|
open: open,
|
|
187
|
-
|
|
186
|
+
closeText: generatedPhrases.length > 0 ? t("cancel") : t("close"),
|
|
187
|
+
handleClose: generatedPhrases.length > 0 ? handleCancel : handleClose,
|
|
188
188
|
handleSubmit: generatedPhrases.length > 0 ? handleConfirm : handleGeneratePhrases,
|
|
189
189
|
submitText: generatedPhrases.length > 0 ? t("confirm") : t("generate_phrases"),
|
|
190
190
|
dialogTitle: isGenerating ? t("generating_phrases") : t("generate_phrases"),
|
|
@@ -33,6 +33,7 @@ function CourseList({
|
|
|
33
33
|
classroomId,
|
|
34
34
|
isClassroomArchived = false,
|
|
35
35
|
email,
|
|
36
|
+
isTeacher,
|
|
36
37
|
...otherProps
|
|
37
38
|
}) {
|
|
38
39
|
const [items, ref] = (0, _useListScroll.default)({
|
|
@@ -98,6 +99,7 @@ function CourseList({
|
|
|
98
99
|
classroomId: classroomId,
|
|
99
100
|
isClassroomArchived: isClassroomArchived,
|
|
100
101
|
email: email,
|
|
102
|
+
isTeacher: isTeacher,
|
|
101
103
|
...otherProps
|
|
102
104
|
}, course.courseId)
|
|
103
105
|
}, course.courseId);
|
|
@@ -141,6 +143,7 @@ function CourseList({
|
|
|
141
143
|
handleDuplicateCourse: handleDuplicateCourse,
|
|
142
144
|
classroomId: classroomId,
|
|
143
145
|
isClassroomArchived: isClassroomArchived,
|
|
146
|
+
isTeacher: isTeacher,
|
|
144
147
|
...otherProps
|
|
145
148
|
}, course.courseId)
|
|
146
149
|
}, course.courseId);
|
|
@@ -204,7 +204,10 @@ function AnswerResult({
|
|
|
204
204
|
transcript = "",
|
|
205
205
|
nextScriptLine,
|
|
206
206
|
phraseWordList = "",
|
|
207
|
-
currentPhrase =
|
|
207
|
+
currentPhrase = {
|
|
208
|
+
phrase: "",
|
|
209
|
+
alternativeVersions: []
|
|
210
|
+
},
|
|
208
211
|
checkIsPronunciationCorrect = () => {},
|
|
209
212
|
languageInformation,
|
|
210
213
|
nualaCelebratingImage,
|
|
@@ -498,7 +498,6 @@ function Classroom({
|
|
|
498
498
|
refreshAssignments,
|
|
499
499
|
progressHelpers,
|
|
500
500
|
preferred_username,
|
|
501
|
-
isUserInternal,
|
|
502
501
|
assignedCourses,
|
|
503
502
|
email,
|
|
504
503
|
...otherProps
|
|
@@ -778,7 +777,8 @@ function Classroom({
|
|
|
778
777
|
banner,
|
|
779
778
|
bannerXs,
|
|
780
779
|
visibility,
|
|
781
|
-
enrolmentKey
|
|
780
|
+
enrolmentKey,
|
|
781
|
+
hiddenCourses = []
|
|
782
782
|
} = classroom;
|
|
783
783
|
const classroomCourses = classroom?.courses || [];
|
|
784
784
|
const courseIds = classroomCourses.toString();
|
|
@@ -838,6 +838,16 @@ function Classroom({
|
|
|
838
838
|
}, {});
|
|
839
839
|
}
|
|
840
840
|
};
|
|
841
|
+
const hideCourse = async courseId => {
|
|
842
|
+
handleUpdateClassroom({
|
|
843
|
+
hiddenCourses: [...hiddenCourses, courseId]
|
|
844
|
+
}, {});
|
|
845
|
+
};
|
|
846
|
+
const unhideCourse = async courseId => {
|
|
847
|
+
handleUpdateClassroom({
|
|
848
|
+
hiddenCourses: hiddenCourses.filter(id => id !== courseId)
|
|
849
|
+
}, {});
|
|
850
|
+
};
|
|
841
851
|
const leaveClassroom = async id => {
|
|
842
852
|
const confirmed = await confirm(t("leave_classroom"), t("leave_classroom_confirmation"));
|
|
843
853
|
if (confirmed) {
|
|
@@ -861,7 +871,7 @@ function Classroom({
|
|
|
861
871
|
className: classes.coursesTab,
|
|
862
872
|
children: [isCoursesLoading || courses !== undefined && courses.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Courses.default, {
|
|
863
873
|
t: t,
|
|
864
|
-
courses: courses !== undefined && courses.length ? courses : null,
|
|
874
|
+
courses: courses !== undefined && courses.length ? isCreator ? courses : courses.filter(course => !hiddenCourses.includes(course.courseId)) : null,
|
|
865
875
|
handleStartCourse: handleStartCourse,
|
|
866
876
|
handleLeaveCourse: handleLeaveCourse,
|
|
867
877
|
handleViewCourseTopic: handleViewCourseTopic,
|
|
@@ -870,6 +880,8 @@ function Classroom({
|
|
|
870
880
|
getMemberDetails: getMemberDetails,
|
|
871
881
|
getMemberInfo: getMemberInfo,
|
|
872
882
|
handleRemoveCourse: isCreator ? removeCourse : null,
|
|
883
|
+
handleHideCourse: isCreator ? hideCourse : null,
|
|
884
|
+
handleUnhideCourse: isCreator ? unhideCourse : null,
|
|
873
885
|
memberPlaceholderImageUrl: memberPlaceholderImageUrl,
|
|
874
886
|
getCourseSections: getCourseSections,
|
|
875
887
|
getCourseMember: getCourseMember,
|
|
@@ -880,7 +892,9 @@ function Classroom({
|
|
|
880
892
|
handleDuplicateCourse: duplicateCourse,
|
|
881
893
|
classroomId: classroomId,
|
|
882
894
|
isClassroomArchived: isArchived,
|
|
883
|
-
|
|
895
|
+
hiddenCourses: hiddenCourses,
|
|
896
|
+
email: email,
|
|
897
|
+
isTeacher: isTeacher
|
|
884
898
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
885
899
|
id: "add-courses-fab",
|
|
886
900
|
children: isCreator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClassCourses.default, {
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _mui = require("tss-react/mui");
|
|
9
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
10
|
+
var _Styles = _interopRequireDefault(require("../../utils/Styles"));
|
|
11
|
+
var _reactRouterDom = require("react-router-dom");
|
|
12
|
+
var _material = require("@mui/material");
|
|
13
|
+
var _Refresh = _interopRequireDefault(require("@mui/icons-material/Refresh"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
// Components
|
|
17
|
+
|
|
18
|
+
function UsersTable({
|
|
19
|
+
classes,
|
|
20
|
+
refresh,
|
|
21
|
+
loading,
|
|
22
|
+
users,
|
|
23
|
+
propsRowChange,
|
|
24
|
+
propsPageChange
|
|
25
|
+
}) {
|
|
26
|
+
const [page, setPage] = (0, _react.useState)(0);
|
|
27
|
+
const [rowsPerPage, setRowsPerPage] = (0, _react.useState)(5);
|
|
28
|
+
const handleChangePage = (event, page) => {
|
|
29
|
+
propsPageChange(page);
|
|
30
|
+
setPage(page);
|
|
31
|
+
};
|
|
32
|
+
const handleChangeRowsPerPage = event => {
|
|
33
|
+
setRowsPerPage(event.target.value);
|
|
34
|
+
propsRowChange(event.target.value);
|
|
35
|
+
};
|
|
36
|
+
const emptyRows = rowsPerPage - Math.min(rowsPerPage, users.length - page * rowsPerPage);
|
|
37
|
+
const handleDownloadCSV = data => {
|
|
38
|
+
const headers = ["Email", "ID", "Number of Classrooms", "Student Count", "Subscription Status", "Verification Status", "Expiration Date"];
|
|
39
|
+
const rows = data.map(row => [row.Attributes.email || "", row.Username || "", row.classrooms || 0, `${row.studentCount || 0}/200`, row.subscriptionStatus || 0, row.verificationStatus || "", row.subscriptionPeriodEnd ? new Date(row.subscriptionPeriodEnd * 1000).toLocaleDateString() : "-"]);
|
|
40
|
+
const csvContent = [headers, ...rows].map(e => e.map(val => `"${String(val).replace(/"/g, '""')}"`) // escape quotes
|
|
41
|
+
.join(",")).join("\n");
|
|
42
|
+
const blob = new Blob([csvContent], {
|
|
43
|
+
type: "text/csv;charset=utf-8;"
|
|
44
|
+
});
|
|
45
|
+
const url = URL.createObjectURL(blob);
|
|
46
|
+
const link = document.createElement("a");
|
|
47
|
+
link.href = url;
|
|
48
|
+
link.setAttribute("download", "users_table.csv");
|
|
49
|
+
document.body.appendChild(link);
|
|
50
|
+
link.click();
|
|
51
|
+
document.body.removeChild(link);
|
|
52
|
+
};
|
|
53
|
+
console.log({
|
|
54
|
+
wah: users,
|
|
55
|
+
location: window.location.origin
|
|
56
|
+
});
|
|
57
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Paper, {
|
|
58
|
+
className: classes.root,
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Toolbar, {
|
|
60
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
61
|
+
variant: "headline",
|
|
62
|
+
color: "inherit",
|
|
63
|
+
children: "Users"
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
65
|
+
className: classes.grow
|
|
66
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
67
|
+
variant: "outlined",
|
|
68
|
+
color: "primary",
|
|
69
|
+
onClick: () => handleDownloadCSV(users),
|
|
70
|
+
children: "Download CSV"
|
|
71
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
72
|
+
"aria-label": "Refresh",
|
|
73
|
+
onClick: refresh,
|
|
74
|
+
size: "large",
|
|
75
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Refresh.default, {})
|
|
76
|
+
})]
|
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Table, {
|
|
78
|
+
className: classes.table,
|
|
79
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableHead, {
|
|
80
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.TableRow, {
|
|
81
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
82
|
+
className: classes.tableCell,
|
|
83
|
+
children: "Email"
|
|
84
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
85
|
+
className: classes.tableCell,
|
|
86
|
+
children: "Number of Classrooms"
|
|
87
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
88
|
+
className: classes.tableCell,
|
|
89
|
+
children: "Student Count"
|
|
90
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
91
|
+
className: classes.tableCell,
|
|
92
|
+
children: "Subscription Status"
|
|
93
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
94
|
+
className: classes.tableCell,
|
|
95
|
+
children: "Verification Status"
|
|
96
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
97
|
+
className: classes.tableCell,
|
|
98
|
+
children: "Expiration Date"
|
|
99
|
+
})]
|
|
100
|
+
})
|
|
101
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.TableBody, {
|
|
102
|
+
children: [!loading ? users.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map(row => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.TableRow, {
|
|
103
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
104
|
+
className: classes.tableCell,
|
|
105
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
|
|
106
|
+
href: `${window.location.origin}/analytics#/activity/member/${row.Username}`,
|
|
107
|
+
target: "_blank",
|
|
108
|
+
color: "inherit",
|
|
109
|
+
children: row.Attributes.email || ""
|
|
110
|
+
})
|
|
111
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
112
|
+
className: classes.tableCell,
|
|
113
|
+
children: row.classrooms || 0
|
|
114
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.TableCell, {
|
|
115
|
+
className: classes.tableCell,
|
|
116
|
+
children: [row.studentCount || 0, "/200"]
|
|
117
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
118
|
+
className: classes.tableCell,
|
|
119
|
+
children: row.subscriptionStatus || 0
|
|
120
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
121
|
+
className: classes.tableCell,
|
|
122
|
+
children: row.verificationStatus || 0
|
|
123
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
124
|
+
className: classes.tableCell,
|
|
125
|
+
children: row.subscriptionPeriodEnd ? new Date(row.subscriptionPeriodEnd * 1000).toLocaleDateString() : "-"
|
|
126
|
+
})]
|
|
127
|
+
}, row.Username)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
128
|
+
className: classes.loadingSpinner
|
|
129
|
+
}), emptyRows > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableRow, {
|
|
130
|
+
style: {
|
|
131
|
+
height: 49 * emptyRows
|
|
132
|
+
},
|
|
133
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
134
|
+
colSpan: 7,
|
|
135
|
+
className: classes.tableCell
|
|
136
|
+
})
|
|
137
|
+
})]
|
|
138
|
+
})]
|
|
139
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TablePagination, {
|
|
140
|
+
rowsPerPageOptions: [5, 10, 50, 100],
|
|
141
|
+
component: "div",
|
|
142
|
+
count: users !== undefined && users.length > 0 ? users.length : 0,
|
|
143
|
+
rowsPerPage: rowsPerPage,
|
|
144
|
+
page: page,
|
|
145
|
+
backIconButtonProps: {
|
|
146
|
+
"aria-label": "Previous Page"
|
|
147
|
+
},
|
|
148
|
+
nextIconButtonProps: {
|
|
149
|
+
"aria-label": "Next Page"
|
|
150
|
+
},
|
|
151
|
+
onPageChange: handleChangePage,
|
|
152
|
+
onRowsPerPageChange: handleChangeRowsPerPage
|
|
153
|
+
})]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
var _default = exports.default = (0, _mui.withStyles)(UsersTable, _Styles.default);
|