@nualang/nualang-ui-components 0.1.1232 → 0.1.1234
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/AssignmentCard/AssignmentCard.js +5 -1
- package/dist/Assignments/AssignmentCardsList/AssignmentCardsList.js +4 -2
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +10 -21
- package/dist/Tables/Progress/Progress.js +69 -49
- package/dist/Tables/Progress/ProgressTable.js +2 -2
- package/package.json +1 -1
|
@@ -27,7 +27,8 @@ function AssignmentCard({
|
|
|
27
27
|
getCourses,
|
|
28
28
|
deleteAssignment,
|
|
29
29
|
handleEditAssignment,
|
|
30
|
-
lastClickedExerciseId
|
|
30
|
+
lastClickedExerciseId,
|
|
31
|
+
handleViewProgress
|
|
31
32
|
}) {
|
|
32
33
|
const [confirm] = (0, _useConfirm.default)(t);
|
|
33
34
|
const handleDeleteAssignment = async (classroomId, assignmentId) => {
|
|
@@ -242,6 +243,9 @@ function AssignmentCard({
|
|
|
242
243
|
marginTop: 2,
|
|
243
244
|
marginLeft: "15px"
|
|
244
245
|
},
|
|
246
|
+
onClick: () => handleViewProgress({
|
|
247
|
+
assignmentId: assignment?.assignmentId
|
|
248
|
+
}),
|
|
245
249
|
children: t("view_progress")
|
|
246
250
|
})]
|
|
247
251
|
})]
|
|
@@ -25,7 +25,8 @@ const AssignmentCardsList = ({
|
|
|
25
25
|
getRoleplays,
|
|
26
26
|
deleteAssignment,
|
|
27
27
|
handleEditAssignment,
|
|
28
|
-
refreshAssignments
|
|
28
|
+
refreshAssignments,
|
|
29
|
+
handleViewProgress
|
|
29
30
|
}) => {
|
|
30
31
|
const [lastClickedExerciseId, setLastClickedExerciseId] = (0, _react.useState)(null);
|
|
31
32
|
(0, _react.useEffect)(() => {
|
|
@@ -134,7 +135,8 @@ const AssignmentCardsList = ({
|
|
|
134
135
|
getRoleplays: getRoleplays,
|
|
135
136
|
deleteAssignment: deleteAssignment,
|
|
136
137
|
handleEditAssignment: handleEditAssignment,
|
|
137
|
-
lastClickedExerciseId: lastClickedExerciseId
|
|
138
|
+
lastClickedExerciseId: lastClickedExerciseId,
|
|
139
|
+
handleViewProgress: handleViewProgress
|
|
138
140
|
}, assignment.assignmentId))]
|
|
139
141
|
})
|
|
140
142
|
});
|
|
@@ -372,16 +372,6 @@ function Classroom({
|
|
|
372
372
|
userInitialValues,
|
|
373
373
|
handleDuplicateCourse,
|
|
374
374
|
freeTrial,
|
|
375
|
-
reportFilters = [],
|
|
376
|
-
filter,
|
|
377
|
-
handleFilterChange,
|
|
378
|
-
reportTypes = [],
|
|
379
|
-
reportType,
|
|
380
|
-
handleReportTypeChange,
|
|
381
|
-
assignmentOptions,
|
|
382
|
-
assignmentValue,
|
|
383
|
-
handleAssignmentChange,
|
|
384
|
-
selectedAssignment,
|
|
385
375
|
handleDeleteClassroomMember,
|
|
386
376
|
handleUpdateClassroomMember,
|
|
387
377
|
vchatProps = {},
|
|
@@ -467,6 +457,12 @@ function Classroom({
|
|
|
467
457
|
handleOpenCreatorNotSubscribedUpgradeModal();
|
|
468
458
|
}
|
|
469
459
|
}, [creatorSubscription]);
|
|
460
|
+
const handleViewProgress = ({
|
|
461
|
+
assignmentId
|
|
462
|
+
}) => {
|
|
463
|
+
setOverwriteValue(tabs.findIndex(tab => tab.id === "Progress"));
|
|
464
|
+
navigate(`?assignmentId=${assignmentId}&reportType=assignments#Progress`);
|
|
465
|
+
};
|
|
470
466
|
(0, _react.useEffect)(() => {
|
|
471
467
|
const handleHashChange = () => {
|
|
472
468
|
if (window.location.hash === "#Settings" && tabs) {
|
|
@@ -871,18 +867,10 @@ function Classroom({
|
|
|
871
867
|
memberId: !isCreator && username,
|
|
872
868
|
username: username,
|
|
873
869
|
getCourseSections: getCourseSections,
|
|
874
|
-
|
|
875
|
-
filter: filter,
|
|
876
|
-
handleFilterChange: handleFilterChange,
|
|
877
|
-
reportTypes: reportTypes,
|
|
878
|
-
reportType: reportType,
|
|
879
|
-
handleReportTypeChange: handleReportTypeChange,
|
|
880
|
-
assignmentOptions: assignmentOptions,
|
|
881
|
-
assignmentValue: assignmentValue,
|
|
882
|
-
handleAssignmentChange: handleAssignmentChange,
|
|
883
|
-
selectedAssignment: selectedAssignment,
|
|
870
|
+
assignments: assignments,
|
|
884
871
|
submissions: submissionsTableData,
|
|
885
|
-
featureFlags: featureFlags
|
|
872
|
+
featureFlags: featureFlags,
|
|
873
|
+
isVideoChatEnabled: isVideoChatEnabled && isVideoChatEnabledInSettings
|
|
886
874
|
})
|
|
887
875
|
}, `tab-content-progress`)
|
|
888
876
|
}, ...(isUserInternal && process.env.REACT_APP_STAGE === "dev" ? [{
|
|
@@ -892,6 +880,7 @@ function Classroom({
|
|
|
892
880
|
TabContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
893
881
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCardsList.default, {
|
|
894
882
|
t: t,
|
|
883
|
+
handleViewProgress: handleViewProgress,
|
|
895
884
|
isCreator: isCreator,
|
|
896
885
|
assignments: assignments,
|
|
897
886
|
courses: courses,
|
|
@@ -36,22 +36,29 @@ const TableToolbar = ({
|
|
|
36
36
|
selectedMembers,
|
|
37
37
|
setSelectedMembers,
|
|
38
38
|
generateOverview,
|
|
39
|
-
|
|
39
|
+
reportFilters,
|
|
40
40
|
filter,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
setFilter,
|
|
42
|
+
reportTypes,
|
|
43
|
+
setReportType,
|
|
44
44
|
reportType,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
assignments,
|
|
46
|
+
selectedAssignment,
|
|
47
|
+
setSelectedAssignment,
|
|
48
48
|
currentView
|
|
49
49
|
}) => {
|
|
50
|
-
// const queryClient = useQueryClient();
|
|
51
50
|
const {
|
|
52
51
|
useQueryClient
|
|
53
52
|
} = _Queries.ReactQuery;
|
|
54
53
|
const queryClient = useQueryClient();
|
|
54
|
+
const reportFilterOptions = reportFilters.map((r, idx) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
55
|
+
value: r,
|
|
56
|
+
children: t(r)
|
|
57
|
+
}, `classroomreportfilter_${idx}`));
|
|
58
|
+
const reportTypeOptions = reportTypes.map((r, idx) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
59
|
+
value: r,
|
|
60
|
+
children: t(r)
|
|
61
|
+
}, `classroomreporttype_${idx}`));
|
|
55
62
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Grid.default, {
|
|
56
63
|
container: true,
|
|
57
64
|
spacing: 1,
|
|
@@ -74,7 +81,7 @@ const TableToolbar = ({
|
|
|
74
81
|
"data-cy": "report_type",
|
|
75
82
|
label: t("report_type"),
|
|
76
83
|
value: reportType,
|
|
77
|
-
onChange:
|
|
84
|
+
onChange: e => setReportType(e.target.value),
|
|
78
85
|
margin: "dense",
|
|
79
86
|
variant: "outlined",
|
|
80
87
|
sx: {
|
|
@@ -91,7 +98,7 @@ const TableToolbar = ({
|
|
|
91
98
|
"data-cy": "report_views",
|
|
92
99
|
label: t("report_views"),
|
|
93
100
|
value: filter,
|
|
94
|
-
onChange:
|
|
101
|
+
onChange: e => setFilter(e.target.value),
|
|
95
102
|
margin: "dense",
|
|
96
103
|
variant: "outlined",
|
|
97
104
|
sx: {
|
|
@@ -107,16 +114,16 @@ const TableToolbar = ({
|
|
|
107
114
|
name: t("assignment"),
|
|
108
115
|
"data-cy": "assignment",
|
|
109
116
|
label: t("assignment"),
|
|
110
|
-
value:
|
|
111
|
-
onChange:
|
|
117
|
+
value: selectedAssignment?.assignmentId,
|
|
118
|
+
onChange: e => setSelectedAssignment(assignments.find(a => a.assignmentId === e.target.value)),
|
|
112
119
|
margin: "dense",
|
|
113
120
|
variant: "outlined",
|
|
114
121
|
sx: {
|
|
115
122
|
minWidth: 250
|
|
116
123
|
},
|
|
117
|
-
children:
|
|
118
|
-
value: assignment,
|
|
119
|
-
children: t(assignment)
|
|
124
|
+
children: assignments.map((assignment, idx) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
125
|
+
value: assignment.assignmentId,
|
|
126
|
+
children: t(assignment.title)
|
|
120
127
|
}, `assignment_${idx}`))
|
|
121
128
|
})
|
|
122
129
|
}), reportType !== "discuss" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
@@ -181,19 +188,11 @@ function Progress({
|
|
|
181
188
|
memberId,
|
|
182
189
|
username,
|
|
183
190
|
getCourseSections,
|
|
184
|
-
reportFilters,
|
|
185
|
-
filter,
|
|
186
|
-
handleFilterChange,
|
|
187
|
-
reportTypes,
|
|
188
|
-
reportType,
|
|
189
|
-
handleReportTypeChange,
|
|
190
|
-
assignmentOptions,
|
|
191
|
-
assignmentValue,
|
|
192
|
-
handleAssignmentChange,
|
|
193
191
|
submissions,
|
|
194
192
|
courseIds,
|
|
195
193
|
featureFlags,
|
|
196
|
-
|
|
194
|
+
assignments = [],
|
|
195
|
+
isVideoChatEnabled
|
|
197
196
|
}) {
|
|
198
197
|
const theme = (0, _styles.useTheme)();
|
|
199
198
|
const isSmallScreen = (0, _useMediaQuery.default)(theme.breakpoints.down("sm"));
|
|
@@ -202,26 +201,28 @@ function Progress({
|
|
|
202
201
|
useQueries
|
|
203
202
|
} = _Queries.ReactQuery;
|
|
204
203
|
const queryClient = useQueryClient();
|
|
204
|
+
const [selectedAssignment, setSelectedAssignment] = (0, _react.useState)(null);
|
|
205
205
|
const [selectedCourse, setSelectedCourse] = (0, _react.useState)(null);
|
|
206
206
|
const [selectedSection, setSelectedSection] = (0, _react.useState)(null);
|
|
207
207
|
const [selectedTopic, setSelectedTopic] = (0, _react.useState)(null);
|
|
208
208
|
const [selectedRoleplay, setSelectedRoleplay] = (0, _react.useState)(null);
|
|
209
209
|
const [roleplays, setRoleplays] = (0, _react.useState)([]);
|
|
210
210
|
const [bots, setBots] = (0, _react.useState)([]);
|
|
211
|
+
const reportFilters = ["percentage_complete", "correct_answer_percentage", "avg_pronunciation_score"];
|
|
212
|
+
const [filter, setFilter] = (0, _react.useState)(reportFilters[0]);
|
|
213
|
+
const reportTypes = isVideoChatEnabled ? ["exercises", "assignments", "discuss"] : ["exercises", "assignments"];
|
|
214
|
+
const [reportType, setReportType] = (0, _react.useState)(reportTypes[0]);
|
|
211
215
|
(0, _react.useEffect)(() => {
|
|
212
216
|
if (selectedTopic) {
|
|
213
217
|
setRoleplays(selectedTopic?.roleplays);
|
|
214
218
|
setBots(selectedTopic?.bots);
|
|
215
219
|
}
|
|
216
220
|
}, [selectedTopic]);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
value: r,
|
|
223
|
-
children: t(r)
|
|
224
|
-
}, `classroomreporttype_${idx}`));
|
|
221
|
+
(0, _react.useEffect)(() => {
|
|
222
|
+
if (!selectedAssignment && assignments && assignments.length) {
|
|
223
|
+
setSelectedAssignment(assignments[0]);
|
|
224
|
+
}
|
|
225
|
+
}, [selectedAssignment, assignments]);
|
|
225
226
|
const courseSectionsQueries = useQueries({
|
|
226
227
|
queries: (courses || []).map(({
|
|
227
228
|
courseId
|
|
@@ -262,6 +263,15 @@ function Progress({
|
|
|
262
263
|
if ("URLSearchParams" in window) {
|
|
263
264
|
const searchParams = (0, _utils2.searchStringToObj)(window.location.search);
|
|
264
265
|
const courseId = searchParams.courseId;
|
|
266
|
+
const assignmentId = searchParams.assignmentId;
|
|
267
|
+
if (searchParams.reportType && reportTypes.includes(searchParams.reportType) && reportType !== searchParams.reportType) {
|
|
268
|
+
setReportType(searchParams.reportType);
|
|
269
|
+
}
|
|
270
|
+
if (assignmentId && !selectedAssignment && assignments && assignments.length) {
|
|
271
|
+
const assignmentIndex = assignments.findIndex(a => a.assignmentId === assignmentId);
|
|
272
|
+
const assignment = assignments[assignmentIndex];
|
|
273
|
+
setSelectedAssignment(assignment);
|
|
274
|
+
}
|
|
265
275
|
if (courseId && !selectedCourse && coursesWithSections && coursesWithSections.length) {
|
|
266
276
|
const courseIndex = coursesWithSections.findIndex(c => c.courseId === courseId);
|
|
267
277
|
const course = coursesWithSections[courseIndex];
|
|
@@ -286,11 +296,21 @@ function Progress({
|
|
|
286
296
|
}
|
|
287
297
|
}
|
|
288
298
|
}
|
|
289
|
-
}, [coursesWithSections, coursesWithSections.length, selectedCourse, selectedSection, selectedTopic, selectedRoleplay]); // on initial render, check for params in url and set the selected items
|
|
299
|
+
}, [coursesWithSections, coursesWithSections.length, selectedCourse, selectedSection, selectedTopic, selectedRoleplay, assignments, selectedAssignment]); // on initial render, check for params in url and set the selected items
|
|
290
300
|
|
|
291
301
|
(0, _react.useEffect)(() => {
|
|
292
302
|
if ("URLSearchParams" in window) {
|
|
293
303
|
const searchParams = (0, _utils2.searchStringToObj)(window.location.search);
|
|
304
|
+
if (reportType && reportType !== reportTypes[0]) {
|
|
305
|
+
searchParams["reportType"] = reportType;
|
|
306
|
+
} else {
|
|
307
|
+
delete searchParams["reportType"];
|
|
308
|
+
}
|
|
309
|
+
if (selectedAssignment) {
|
|
310
|
+
searchParams["assignmentId"] = selectedAssignment.assignmentId;
|
|
311
|
+
} else {
|
|
312
|
+
delete searchParams["assignmentId"];
|
|
313
|
+
}
|
|
294
314
|
if (selectedCourse) {
|
|
295
315
|
searchParams["courseId"] = selectedCourse.courseId;
|
|
296
316
|
if (selectedSection) {
|
|
@@ -312,7 +332,7 @@ function Progress({
|
|
|
312
332
|
const newRelativePathQuery = window.location.pathname + "?" + (0, _utils2.objToSearchString)(searchParams) + window.location.hash;
|
|
313
333
|
window.history.pushState(null, "", newRelativePathQuery);
|
|
314
334
|
}
|
|
315
|
-
}, [selectedCourse, selectedSection, selectedTopic, selectedRoleplay]); // If selections change, update the url to reflect those changes
|
|
335
|
+
}, [selectedCourse, selectedSection, selectedTopic, selectedRoleplay, selectedAssignment, reportType]); // If selections change, update the url to reflect those changes
|
|
316
336
|
|
|
317
337
|
let classroomMembers = members.sort((a, b) => (a.username || "").localeCompare(b.username || ""));
|
|
318
338
|
let currentView = "all_courses";
|
|
@@ -441,15 +461,15 @@ function Progress({
|
|
|
441
461
|
selectedMembers: selectedMembers,
|
|
442
462
|
setSelectedMembers: setSelectedMembers,
|
|
443
463
|
generateOverview: generateOverview,
|
|
444
|
-
|
|
464
|
+
reportFilters: reportFilters,
|
|
445
465
|
filter: filter,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
466
|
+
setFilter: setFilter,
|
|
467
|
+
reportTypes: reportTypes,
|
|
468
|
+
setReportType: setReportType,
|
|
449
469
|
reportType: reportType,
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
470
|
+
assignments: assignments,
|
|
471
|
+
selectedAssignment: selectedAssignment,
|
|
472
|
+
setSelectedAssignment: setSelectedAssignment,
|
|
453
473
|
currentView: currentView
|
|
454
474
|
}), reportType === "discuss" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Grid.default, {
|
|
455
475
|
container: true,
|
|
@@ -510,15 +530,15 @@ function Progress({
|
|
|
510
530
|
selectedMembers: selectedMembers,
|
|
511
531
|
setSelectedMembers: setSelectedMembers,
|
|
512
532
|
generateOverview: generateOverview,
|
|
513
|
-
|
|
533
|
+
reportFilters: reportFilters,
|
|
514
534
|
filter: filter,
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
535
|
+
setFilter: setFilter,
|
|
536
|
+
reportTypes: reportTypes,
|
|
537
|
+
setReportType: setReportType,
|
|
518
538
|
reportType: reportType,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
539
|
+
assignments: assignments,
|
|
540
|
+
selectedAssignment: selectedAssignment,
|
|
541
|
+
setSelectedAssignment: setSelectedAssignment,
|
|
522
542
|
currentView: currentView
|
|
523
543
|
}), reportType === "discuss" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Grid.default, {
|
|
524
544
|
container: true,
|
|
@@ -811,11 +811,11 @@ function ProgressTable({
|
|
|
811
811
|
featureFlags,
|
|
812
812
|
reportType
|
|
813
813
|
}) {
|
|
814
|
-
const selectedAssignmentTopics = selectedAssignment?.exercises
|
|
814
|
+
const selectedAssignmentTopics = (selectedAssignment?.exercises || [])?.map(e => e.courseSectionTopicId);
|
|
815
815
|
const assignmentTopics = courses.flatMap(c => c.sections.flatMap(s => s.topics)).filter(t => selectedAssignmentTopics?.includes(`${t.courseSectionId}|${t.topicId}`));
|
|
816
816
|
const topics = reportType === "exercises" && selectedCourse && selectedSection ? selectedCourse.sections[selectedCourse.sections.findIndex(s => s.sectionId === selectedSection.sectionId)].topics : [];
|
|
817
817
|
const tableTopics = reportType === "assignments" ? assignmentTopics : topics;
|
|
818
|
-
const assignmentExercises = reportType === "assignments" && selectedTopic ? selectedAssignment?.exercises.filter(e => e.courseSectionTopicId === `${selectedTopic.courseSectionId}|${selectedTopic.topicId}`) : [];
|
|
818
|
+
const assignmentExercises = reportType === "assignments" && selectedTopic ? (selectedAssignment?.exercises || []).filter(e => e.courseSectionTopicId === `${selectedTopic.courseSectionId}|${selectedTopic.topicId}`) : [];
|
|
819
819
|
const exercises = ["translation", "listening", "pronunciation"];
|
|
820
820
|
const tableExercises = assignmentExercises && assignmentExercises.length ? exercises.filter(e => assignmentExercises.some(ae => ae.name === e)) : exercises;
|
|
821
821
|
const tableRoleplays = assignmentExercises && assignmentExercises.length ? roleplays.filter(r => assignmentExercises.some(ae => ae.roleplayId === r.roleplayId)) : roleplays;
|