@nualang/nualang-ui-components 0.1.1230 → 0.1.1232

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.
Files changed (24) hide show
  1. package/dist/Assignments/AssignmentCard/AssignmentCard.js +37 -33
  2. package/dist/Assignments/AssignmentCardsList/AssignmentCardsList.js +19 -17
  3. package/dist/Assignments/AssignmentCourseSelection/AssignmentCourseSelection.js +9 -4
  4. package/dist/Assignments/AssignmentExerciseSelection/AssignmentExerciseSelection.js +38 -7
  5. package/dist/Assignments/AssignmentExerciseSelector/AssignmentExerciseSelector.js +4 -2
  6. package/dist/Assignments/AssignmentRoleplaySelection/AssignmentRoleplaySelection.js +19 -8
  7. package/dist/Assignments/AssignmentSelectExercise/AssignmentSelectExercise.js +2 -2
  8. package/dist/Assignments/CreateAssignmentDialog/CreateAssignmentDialog.js +5 -5
  9. package/dist/Cards/SubscriptionPlan/SubscriptionPlan.js +12 -12
  10. package/dist/Containers/App/App.js +3 -2
  11. package/dist/Dialogs/Listener/Listener.js +1 -1
  12. package/dist/Dialogs/RecordingDialog/RecordingDialog.js +41 -19
  13. package/dist/Lists/RoleplaySelection/RoleplaySelection.js +1 -1
  14. package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +16 -2
  15. package/dist/Tables/MeetingPrompstList/MeetingPromptsList.js +5 -1
  16. package/dist/Tables/Progress/Progress.js +137 -77
  17. package/dist/Tables/Progress/ProgressTable.js +240 -64
  18. package/dist/Tables/Progress/utils.js +7 -242
  19. package/dist/Tables/RecordingListCards/RecordingListCards.js +1 -1
  20. package/dist/Tables/ScheduleListCards/ScheduleListCards.js +3 -9
  21. package/dist/Tables/SubmissionsTableCards/SubmissionsTableCards.js +10 -1
  22. package/dist/utils/constants.js +33 -2
  23. package/dist/utils/index.js +221 -148
  24. package/package.json +1 -1
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = AssignmentCard;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
9
- var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
10
- var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
11
9
  var _material = require("@mui/material");
12
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
11
  var _AssignmentExerciseSelector = _interopRequireDefault(require("../AssignmentExerciseSelector/AssignmentExerciseSelector"));
14
12
  var _Queries = require("@nualang/nualang-api-and-queries/Queries");
15
13
  var _useConfirm = _interopRequireDefault(require("../../hooks/useConfirm"));
14
+ var _iconsMaterial = require("@mui/icons-material");
16
15
  var _jsxRuntime = require("react/jsx-runtime");
17
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -28,19 +27,29 @@ function AssignmentCard({
28
27
  getCourses,
29
28
  deleteAssignment,
30
29
  handleEditAssignment,
31
- isExpanded,
32
- setExpandedAssignmentId
30
+ lastClickedExerciseId
33
31
  }) {
34
32
  const [confirm] = (0, _useConfirm.default)(t);
35
33
  const handleDeleteAssignment = async (classroomId, assignmentId) => {
36
- const confirmed = await confirm(t('delete_assignment'), t('delete_assignment_confirmation'));
34
+ const confirmed = await confirm(t("delete_assignment"), t("delete_assignment_confirmation"));
37
35
  if (confirmed) {
38
36
  await deleteAssignment(classroomId, assignmentId);
39
37
  }
40
38
  };
41
- const calculateDaysUntilDue = dueDate => {
39
+ const calculateDaysUntilDue = (dueDate, scheduledDate) => {
42
40
  const now = new Date();
43
41
  const due = new Date(dueDate);
42
+ const scheduled = new Date(scheduledDate);
43
+ if (scheduled > now) {
44
+ const daysUntilScheduled = Math.ceil((scheduled - now) / (1000 * 60 * 60 * 24));
45
+ if (daysUntilScheduled === 1) {
46
+ return t("available_tomorrow");
47
+ } else if (daysUntilScheduled === 0) {
48
+ return t("available_today");
49
+ } else {
50
+ return `${t("available_in")} ${daysUntilScheduled} ${t("days")}`;
51
+ }
52
+ }
44
53
  const diffTime = due - now;
45
54
  const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
46
55
  if (diffDays < 0) {
@@ -53,10 +62,6 @@ function AssignmentCard({
53
62
  return `${t("due_in")} ${diffDays} ${t("days")}`;
54
63
  }
55
64
  };
56
- const handleIconClick = event => {
57
- event.stopPropagation();
58
- setExpandedAssignmentId(prevId => prevId === assignment.assignmentId ? null : assignment.assignmentId);
59
- };
60
65
  const {
61
66
  uniqueCourses
62
67
  } = (0, _react.useMemo)(() => {
@@ -136,34 +141,32 @@ function AssignmentCard({
136
141
  children: `${Math.round(assignment.completed / assignment.assignedStudents.length * 100)}%`
137
142
  })]
138
143
  })]
139
- }), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
140
- item: true,
141
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
142
- onClick: () => handleEditAssignment(assignment),
143
- color: "primary",
144
- children: t("edit")
145
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Button, {
146
- color: "primary",
147
- onClick: () => {
148
- handleDeleteAssignment(assignment.classroomId, assignment.assignmentId);
149
- },
150
- children: [t("delete"), " "]
151
- })]
152
144
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
153
145
  item: true,
154
146
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
155
147
  variant: "button",
156
148
  color: "text.secondary",
157
- children: calculateDaysUntilDue(assignment.dueDate)
149
+ children: calculateDaysUntilDue(assignment.dueDate, assignment.scheduleDate)
158
150
  })
159
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
151
+ }), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
160
152
  item: true,
161
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
162
- onClick: handleIconClick,
163
- children: isExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})
164
- })
153
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
154
+ title: t("edit"),
155
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.IconButton, {
156
+ onClick: () => handleEditAssignment(assignment),
157
+ children: [" ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Edit, {}), " "]
158
+ })
159
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
160
+ title: t("delete"),
161
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.IconButton, {
162
+ onClick: () => {
163
+ handleDeleteAssignment(assignment.classroomId, assignment.assignmentId);
164
+ },
165
+ children: [" ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Delete, {}), " "]
166
+ })
167
+ })]
165
168
  })]
166
- }), isExpanded && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
169
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
167
170
  mt: 2,
168
171
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
169
172
  sx: {
@@ -181,7 +184,7 @@ function AssignmentCard({
181
184
  children: assignment.instructions
182
185
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
183
186
  mt: 2,
184
- width: "80%",
187
+ width: isCreator ? "80%" : "100%",
185
188
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentExerciseSelector.default, {
186
189
  t: t,
187
190
  assignment: assignment,
@@ -191,14 +194,15 @@ function AssignmentCard({
191
194
  getRoleplays: getRoleplays,
192
195
  isCreator: isCreator,
193
196
  viewOnly: true,
194
- useCase: isCreator ? "assignment-view" : "assignment-start"
197
+ useCase: isCreator ? "assignment-view" : "assignment-start",
198
+ lastClickedExerciseId: lastClickedExerciseId
195
199
  })
196
200
  })]
197
201
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
198
202
  item: true,
199
203
  xs: 3,
200
204
  md: 2,
201
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
205
+ children: [isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
202
206
  display: "flex",
203
207
  justifyContent: "space-between",
204
208
  alignItems: "center",
@@ -27,22 +27,21 @@ const AssignmentCardsList = ({
27
27
  handleEditAssignment,
28
28
  refreshAssignments
29
29
  }) => {
30
- const [expandedAssignmentId, setExpandedAssignmentId] = (0, _react.useState)(null);
30
+ const [lastClickedExerciseId, setLastClickedExerciseId] = (0, _react.useState)(null);
31
31
  (0, _react.useEffect)(() => {
32
- const storedId = localStorage.getItem("expandedAssignmentId");
33
- if (storedId) {
34
- setExpandedAssignmentId(JSON.parse(storedId));
32
+ const stored = localStorage.getItem("lastClickedExercise");
33
+ if (stored) {
34
+ try {
35
+ const parsed = JSON.parse(stored);
36
+ if (parsed?.courseSectionTopicId) {
37
+ setLastClickedExerciseId(parsed.courseSectionTopicId);
38
+ }
39
+ } catch (e) {
40
+ console.error("Error parsing lastClickedExercise", e);
41
+ }
35
42
  }
36
43
  }, []);
37
- (0, _react.useEffect)(() => {
38
- if (expandedAssignmentId) {
39
- localStorage.setItem("expandedAssignmentId", JSON.stringify(expandedAssignmentId));
40
- } else {
41
- localStorage.removeItem("expandedAssignmentId");
42
- }
43
- }, [expandedAssignmentId]);
44
44
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
45
- mt: 3,
46
45
  mb: 1,
47
46
  children: assignments.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
48
47
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
@@ -64,14 +63,14 @@ const AssignmentCardsList = ({
64
63
  sx: {
65
64
  textAlign: "center",
66
65
  mt: 2,
67
- width: '70%'
66
+ width: "70%"
68
67
  },
69
68
  children: t("no_assignments_description")
70
69
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
71
70
  sx: {
72
71
  textAlign: "center",
73
72
  mt: 2,
74
- width: '70%'
73
+ width: "70%"
75
74
  },
76
75
  children: t("assignments_description")
77
76
  }), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
@@ -122,7 +121,11 @@ const AssignmentCardsList = ({
122
121
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Refresh.default, {})
123
122
  })
124
123
  })]
125
- }), assignments.map(assignment => /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCard.default, {
124
+ }), assignments.filter(assignment => {
125
+ if (isCreator) return true;
126
+ if (!assignment.scheduleDate) return true;
127
+ return new Date(assignment.scheduleDate) <= new Date();
128
+ }).map(assignment => /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCard.default, {
126
129
  assignment: assignment,
127
130
  t: t,
128
131
  isCreator: isCreator,
@@ -131,8 +134,7 @@ const AssignmentCardsList = ({
131
134
  getRoleplays: getRoleplays,
132
135
  deleteAssignment: deleteAssignment,
133
136
  handleEditAssignment: handleEditAssignment,
134
- isExpanded: expandedAssignmentId === assignment.assignmentId,
135
- setExpandedAssignmentId: setExpandedAssignmentId
137
+ lastClickedExerciseId: lastClickedExerciseId
136
138
  }, assignment.assignmentId))]
137
139
  })
138
140
  });
@@ -28,9 +28,11 @@ function Course({
28
28
  assignment,
29
29
  handleStartExercise,
30
30
  isCreator,
31
- viewOnly
31
+ viewOnly,
32
+ lastClickedExerciseId
32
33
  }) {
33
- const [open, setOpen] = (0, _react.useState)(false);
34
+ const numOfIds = lastClickedExerciseId ? lastClickedExerciseId.split('|') : [];
35
+ const [open, setOpen] = (0, _react.useState)(lastClickedExerciseId && (numOfIds.length === 4 && lastClickedExerciseId.endsWith(`|${assignment.assignmentId}`) || numOfIds.length === 5 && lastClickedExerciseId.split('|')[3] === assignment.assignmentId));
34
36
  const [selectedSectionIds, setSelectedSectionIds] = (0, _react.useState)([]);
35
37
  const [filteredSections, setFilteredSections] = (0, _react.useState)([]);
36
38
  const sectionsQuery = _Queries.courses.useCourseSections(async (courseId, filters) => {
@@ -127,7 +129,8 @@ function Course({
127
129
  assignment: assignment,
128
130
  handleStartExercise: handleStartExercise,
129
131
  isCreator: isCreator,
130
- viewOnly: viewOnly
132
+ viewOnly: viewOnly,
133
+ lastClickedExerciseId: lastClickedExerciseId
131
134
  })
132
135
  })
133
136
  })]
@@ -148,6 +151,7 @@ function AssignmentCourseSelection({
148
151
  handleStartExercise,
149
152
  isCreator,
150
153
  viewOnly,
154
+ lastClickedExerciseId,
151
155
  ...otherProps
152
156
  }) {
153
157
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -166,7 +170,8 @@ function AssignmentCourseSelection({
166
170
  assignment: assignment,
167
171
  handleStartExercise: handleStartExercise,
168
172
  isCreator: isCreator,
169
- viewOnly: viewOnly
173
+ viewOnly: viewOnly,
174
+ lastClickedExerciseId: lastClickedExerciseId
170
175
  }))
171
176
  });
172
177
  }
@@ -34,7 +34,8 @@ function Exercise({
34
34
  handleSelectExercise = null,
35
35
  selectedExercises,
36
36
  useCase,
37
- assignment
37
+ assignment,
38
+ lastClickedExerciseId
38
39
  }) {
39
40
  const [listeningHidden, setListeningHidden] = (0, _react.useState)(false);
40
41
  const [translationHidden, setTranslationHidden] = (0, _react.useState)(false);
@@ -49,6 +50,10 @@ function Exercise({
49
50
  } = params;
50
51
  const [courseId, sectionId, topicId] = courseSectionTopicId.split("|");
51
52
  const addSearchParams = () => {
53
+ const lastClickedExercise = {
54
+ courseSectionTopicId: `${courseSectionTopicId}|${assignment.assignmentId}`
55
+ };
56
+ localStorage.setItem("lastClickedExercise", JSON.stringify(lastClickedExercise));
52
57
  const assignmentParam = encodeURIComponent(JSON.stringify(assignment));
53
58
  navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}?exercise=${name}&assignment=${assignmentParam}`);
54
59
  };
@@ -137,7 +142,8 @@ function Exercise({
137
142
  handleSelectExercise: handleSelectExercise,
138
143
  selectedExercises: selectedExercises,
139
144
  useCase: useCase,
140
- assignment: assignment
145
+ assignment: assignment,
146
+ lastClickedExerciseId: lastClickedExerciseId
141
147
  })
142
148
  })
143
149
  })]
@@ -161,6 +167,7 @@ function ExerciseList({
161
167
  assignment,
162
168
  handleStartExercise,
163
169
  isCreator,
170
+ lastClickedExerciseId,
164
171
  ...otherProps
165
172
  }) {
166
173
  const courseSectionTopicId = `${courseId}|${sectionId}|${topicId}`;
@@ -188,6 +195,7 @@ function ExerciseList({
188
195
  assignment: assignment,
189
196
  handleStartExercise: handleStartExercise,
190
197
  isCreator: isCreator,
198
+ lastClickedExerciseId: lastClickedExerciseId,
191
199
  ...otherProps
192
200
  }, keyId);
193
201
  })
@@ -226,12 +234,23 @@ function Topic({
226
234
  assignment,
227
235
  handleStartExercise,
228
236
  isCreator,
237
+ lastClickedExerciseId,
229
238
  ...otherProps
230
239
  }) {
231
240
  const theme = (0, _styles.useTheme)();
232
241
  const isLargeScreen = (0, _useMediaQuery.default)(theme.breakpoints.up("sm"));
233
- const [isExerciseListOpen, setExerciseListOpen] = (0, _react.useState)(false);
242
+ const topicRef = (0, _react.useRef)(null);
243
+ const [lasClickedCourseId, lasClickedSectionId, lasClickedTopicId, lastClickedAssignmentId] = lastClickedExerciseId?.split("|") || [];
244
+ const [isExerciseListOpen, setExerciseListOpen] = (0, _react.useState)(lasClickedTopicId === topicId && lastClickedAssignmentId === assignment.assignmentId);
234
245
  const [isWholeTopicSelected, setIsWholeTopicSelected] = (0, _react.useState)(false);
246
+ (0, _react.useEffect)(() => {
247
+ if (lasClickedTopicId === topicId && topicRef.current) {
248
+ topicRef.current.scrollIntoView({
249
+ behavior: "smooth",
250
+ block: "start"
251
+ });
252
+ }
253
+ }, []);
235
254
  let exercises;
236
255
  switch (useCase) {
237
256
  case "assignment-select":
@@ -294,7 +313,7 @@ function Topic({
294
313
  games = ["roleplay-story", "roleplay-fill-in-the-blanks", "roleplay-act-it-out", "roleplay-act-it-out-listening", "roleplay-act-it-out-speaking", "roleplay-act-it-out-listening-speaking"];
295
314
  }
296
315
  (0, _react.useEffect)(() => {
297
- const exerciseCount = selectedExercises?.filter(exercise => exercise.courseSectionTopicId === `${courseId}|${sectionId}|${topicId}`).length;
316
+ const exerciseCount = selectedExercises?.filter(exercise => !exercise.roleplayId && exercise.courseSectionTopicId === `${courseId}|${sectionId}|${topicId}`).length;
298
317
  const roleplayCount = selectedExercises?.filter(exercise => exercise.roleplayId && roleplays?.some(roleplay => roleplay.roleplayId === exercise.roleplayId)).length;
299
318
  const total = roleplays.length * 6 + 3;
300
319
  if (exerciseCount + roleplayCount === total) {
@@ -322,7 +341,9 @@ function Topic({
322
341
  if (!selectedExercises?.some(e => e.roleplayId === roleplay.roleplayId && e.game === game)) {
323
342
  exercisesToAdd = [...exercisesToAdd, {
324
343
  roleplayId: roleplay.roleplayId,
325
- game
344
+ game,
345
+ courseSectionTopicId: `${courseId}|${sectionId}|${topicId}`,
346
+ roleplayName: roleplay.roleplayName
326
347
  }];
327
348
  }
328
349
  });
@@ -344,6 +365,7 @@ function Topic({
344
365
  justifyContent: "space-between",
345
366
  onClick: toggleExerciseList,
346
367
  "data-cy": "topic-list-item",
368
+ ref: topicRef,
347
369
  disabled: phrases.length === 0 && !hasNonEmptyRoleplay || isExerciseSelected,
348
370
  children: [isLargeScreen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
349
371
  children: picture ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
@@ -431,6 +453,7 @@ function Topic({
431
453
  assignment: assignment,
432
454
  handleStartExercise: handleStartExercise,
433
455
  isCreator: isCreator,
456
+ lastClickedExerciseId: lastClickedExerciseId,
434
457
  ...otherProps
435
458
  })
436
459
  })]
@@ -455,6 +478,7 @@ function Section({
455
478
  handleStartExercise,
456
479
  isCreator,
457
480
  viewOnly,
481
+ lastClickedExerciseId,
458
482
  ...otherProps
459
483
  }) {
460
484
  const root = {
@@ -516,7 +540,8 @@ function Section({
516
540
  useCase: useCase,
517
541
  assignment: assignment,
518
542
  handleStartExercise: handleStartExercise,
519
- isCreator: isCreator
543
+ isCreator: isCreator,
544
+ lastClickedExerciseId: lastClickedExerciseId
520
545
  }, `${sectionId}-${topic.topicId}`)) : topics.map((topic, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Topic, {
521
546
  index: i,
522
547
  topics: topics,
@@ -537,7 +562,8 @@ function Section({
537
562
  useCase: useCase,
538
563
  assignment: assignment,
539
564
  handleStartExercise: handleStartExercise,
540
- isCreator: isCreator
565
+ isCreator: isCreator,
566
+ lastClickedExerciseId: lastClickedExerciseId
541
567
  }, `${sectionId}-${topic.topicId}`))
542
568
  })
543
569
  });
@@ -558,6 +584,7 @@ function SectionList({
558
584
  handleStartExercise,
559
585
  isCreator,
560
586
  viewOnly,
587
+ lastClickedExerciseId,
561
588
  ...otherProps
562
589
  }) {
563
590
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
@@ -580,6 +607,7 @@ function SectionList({
580
607
  handleStartExercise: handleStartExercise,
581
608
  isCreator: isCreator,
582
609
  viewOnly: viewOnly,
610
+ lastClickedExerciseId: lastClickedExerciseId,
583
611
  ...otherProps
584
612
  }, section.sectionId);
585
613
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
@@ -607,6 +635,7 @@ function AssignmentExerciseSelection({
607
635
  assignment,
608
636
  handleStartExercise,
609
637
  viewOnly,
638
+ lastClickedExerciseId,
610
639
  ...otherProps
611
640
  }) {
612
641
  if (isLoading) {
@@ -627,6 +656,7 @@ function AssignmentExerciseSelection({
627
656
  assignment: assignment,
628
657
  handleStartExercise: handleStartExercise,
629
658
  viewOnly: viewOnly,
659
+ lastClickedExerciseId: lastClickedExerciseId,
630
660
  ...otherProps
631
661
  })
632
662
  });
@@ -649,6 +679,7 @@ function AssignmentExerciseSelection({
649
679
  useCase: useCase,
650
680
  assignment: assignment,
651
681
  viewOnly: viewOnly,
682
+ lastClickedExerciseId: lastClickedExerciseId,
652
683
  ...otherProps
653
684
  })
654
685
  });
@@ -19,7 +19,8 @@ function AssignmentExerciseSelector({
19
19
  isCreator,
20
20
  selectedExercises,
21
21
  viewOnly,
22
- useCase
22
+ useCase,
23
+ lastClickedExerciseId
23
24
  }) {
24
25
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Box, {
25
26
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCourseSelection.default, {
@@ -33,7 +34,8 @@ function AssignmentExerciseSelector({
33
34
  isCreator: isCreator,
34
35
  selectedExercises: selectedExercises,
35
36
  viewOnly: viewOnly,
36
- useCase: useCase
37
+ useCase: useCase,
38
+ lastClickedExerciseId: lastClickedExerciseId
37
39
  })
38
40
  });
39
41
  }
@@ -28,7 +28,8 @@ function Roleplay({
28
28
  handleSelectExercise = null,
29
29
  selectedExercises,
30
30
  useCase,
31
- assignment
31
+ assignment,
32
+ lastClickedExerciseId
32
33
  }) {
33
34
  const navigate = (0, _reactRouterDom.useNavigate)();
34
35
  const params = (0, _reactRouterDom.useParams)();
@@ -36,15 +37,20 @@ function Roleplay({
36
37
  classroomId
37
38
  } = params;
38
39
  const [courseId, sectionId, topicId] = courseSectionTopicId ? courseSectionTopicId.split("|") : "";
40
+ const [lasClickedCourseId, lasClickedSectionId, lasClickedTopicId, lastClickedAssignmentId, lastClickedRoleplayId] = lastClickedExerciseId?.split("|") || [];
39
41
  const addSearchParams = exercise => {
40
42
  if (!classroomId || !courseId || !sectionId || !topicId || !roleplay?.roleplayId) {
41
- console.error('Missing required parameters for navigation');
43
+ console.error("Missing required parameters for navigation");
42
44
  return;
43
45
  }
46
+ const lastClickedExercise = {
47
+ courseSectionTopicId: `${courseSectionTopicId}|${assignment.assignmentId}|${roleplay.roleplayId}`
48
+ };
49
+ localStorage.setItem("lastClickedExercise", JSON.stringify(lastClickedExercise));
44
50
  const assignmentParam = encodeURIComponent(JSON.stringify(assignment));
45
51
  navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}/roleplays/${roleplay?.roleplayId}?game=${encodeURIComponent(exercise)}&assignment=${assignmentParam}`);
46
52
  };
47
- const [open, setOpen] = (0, _react.useState)(false);
53
+ const [open, setOpen] = (0, _react.useState)(lastClickedRoleplayId === roleplay.roleplayId && lastClickedAssignmentId === assignment.assignmentId);
48
54
  const games = ["roleplay-story", "roleplay-fill-in-the-blanks", "roleplay-act-it-out", "roleplay-act-it-out-listening", "roleplay-act-it-out-speaking", "roleplay-act-it-out-listening-speaking"];
49
55
  const [isSelectAllChecked, setIsSelectAllChecked] = (0, _react.useState)(false);
50
56
  (0, _react.useEffect)(() => {
@@ -64,7 +70,9 @@ function Roleplay({
64
70
  if (!selectedExercises?.some(e => e.roleplayId === roleplay.roleplayId && e.game === game)) {
65
71
  gamesToAdd = [...gamesToAdd, {
66
72
  roleplayId: roleplay.roleplayId,
67
- game
73
+ game,
74
+ courseSectionTopicId: roleplay.courseSectionTopicId,
75
+ roleplayName: roleplay.roleplayName
68
76
  }];
69
77
  }
70
78
  });
@@ -105,7 +113,7 @@ function Roleplay({
105
113
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
106
114
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
107
115
  title: !isRoleplayValid ? t("roleplay_not_valid") : "",
108
- placement: "left",
116
+ placement: "right",
109
117
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
110
118
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
111
119
  onClick: () => setOpen(!open),
@@ -214,7 +222,8 @@ function Roleplay({
214
222
  children: [useCase === "assignment-select" && games.map((game, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
215
223
  onClick: () => handleSelectExercise([{
216
224
  roleplayId: roleplay.roleplayId,
217
- game
225
+ game,
226
+ courseSectionTopicId: roleplay.courseSectionTopicId
218
227
  }]),
219
228
  sx: {
220
229
  display: "flex",
@@ -271,7 +280,8 @@ function AssignmentRoleplaySelection({
271
280
  handleSelectExercise,
272
281
  selectedExercises,
273
282
  useCase,
274
- assignment
283
+ assignment,
284
+ lastClickedExerciseId
275
285
  }) {
276
286
  const [isRoleplaySelected, setIsRoleplaySelected] = (0, _react.useState)(false);
277
287
  return roleplays.map((roleplay, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Roleplay, {
@@ -284,7 +294,8 @@ function AssignmentRoleplaySelection({
284
294
  handleSelectExercise: handleSelectExercise,
285
295
  selectedExercises: selectedExercises,
286
296
  useCase: useCase,
287
- assignment: assignment
297
+ assignment: assignment,
298
+ lastClickedExerciseId: lastClickedExerciseId
288
299
  }, index));
289
300
  }
290
301
  var _default = exports.default = AssignmentRoleplaySelection;
@@ -29,10 +29,10 @@ function AssignmentSelectExercise({
29
29
  setSelectedExercises(prevSelectedExercises => {
30
30
  let updatedExercises = [...prevSelectedExercises];
31
31
  exercises.forEach(exercise => {
32
- if (exercise.courseSectionTopicId && updatedExercises.some(e => e.courseSectionTopicId === exercise.courseSectionTopicId && e.name === exercise.name)) {
32
+ if (exercise.courseSectionTopicId && !exercise.roleplayId && updatedExercises.some(e => e.courseSectionTopicId === exercise.courseSectionTopicId && e.name === exercise.name)) {
33
33
  updatedExercises = updatedExercises.filter(e => e.courseSectionTopicId !== exercise.courseSectionTopicId || e.name !== exercise.name);
34
34
  } else if (exercise.roleplayId && updatedExercises.some(e => e.roleplayId === exercise.roleplayId && e.game === exercise.game)) {
35
- updatedExercises = updatedExercises.filter(e => !!e.courseSectionTopicId || e.roleplayId !== exercise.roleplayId || e.game !== exercise.game);
35
+ updatedExercises = updatedExercises.filter(e => !!e.courseSectionTopicId && !e.roleplayId || e.roleplayId !== exercise.roleplayId || e.game !== exercise.game);
36
36
  } else {
37
37
  updatedExercises.push(exercise);
38
38
  }
@@ -336,17 +336,17 @@ function CreateAssignmentDialog({
336
336
  })
337
337
  })]
338
338
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
339
- sx: {
339
+ sx: theme => ({
340
340
  position: "fixed",
341
341
  bottom: 0,
342
342
  width: "100%",
343
- backgroundColor: "white",
344
- boxShadow: "0 -2px 5px rgba(0,0,0,0.1)",
343
+ backgroundColor: theme.palette.background.paper,
344
+ boxShadow: theme.shadows[4],
345
345
  p: 2,
346
346
  textAlign: "center",
347
347
  display: "flex",
348
348
  justifyContent: "flex-end"
349
- },
349
+ }),
350
350
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
351
351
  color: "primary",
352
352
  sx: {
@@ -407,7 +407,7 @@ function CreateAssignmentDialog({
407
407
  color: "primary",
408
408
  fullWidth: true,
409
409
  onClick: () => {
410
- handleCreateAssignment;
410
+ handleCreateAssignment();
411
411
  handleMenuClose();
412
412
  },
413
413
  children: t("schedule_assignment")
@@ -234,7 +234,7 @@ function SubscriptionPlan({
234
234
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardContent, {
235
235
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PlanTitle, {
236
236
  variant: "h6",
237
- children: displayPlan.title
237
+ children: t(displayPlan.title)
238
238
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(PlanPricing, {
239
239
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PlanPricingTotal, {
240
240
  variant: "h3",
@@ -251,12 +251,12 @@ function SubscriptionPlan({
251
251
  title: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
252
252
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactMarkdown.default, {
253
253
  className: classes.planFeaturesListItemTooltipContent,
254
- children: displayPlan.footnote
254
+ children: t(displayPlan.footnote)
255
255
  })
256
256
  }),
257
257
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Badge, {
258
258
  component: "div",
259
- children: displayPlan.badge
259
+ children: t(displayPlan.badge)
260
260
  })
261
261
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {}), priceInfo && priceInfo.interval && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
262
262
  variant: "subtitle1",
@@ -265,7 +265,7 @@ function SubscriptionPlan({
265
265
  })]
266
266
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PlanSubtitle, {
267
267
  variant: "subtitle1",
268
- children: displayPlan.subtitle
268
+ children: t(displayPlan.subtitle)
269
269
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PlanFeaturesList, {
270
270
  children: (displayPlan.benefits || []).map((feature, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(PlanFeaturesListItem, {
271
271
  children: [feature.supported ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckCircle.default, {
@@ -282,12 +282,12 @@ function SubscriptionPlan({
282
282
  title: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
283
283
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactMarkdown.default, {
284
284
  className: classes.planFeaturesListItemTooltipContent,
285
- children: feature.description
285
+ children: t(feature.description)
286
286
  })
287
287
  }),
288
288
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(PlanFeaturesListItemLabel, {
289
289
  variant: "subtitle2",
290
- children: [feature.label, /*#__PURE__*/(0, _jsxRuntime.jsx)(_HelpOutline.default, {
290
+ children: [t(feature.label), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HelpOutline.default, {
291
291
  fontSize: "small",
292
292
  sx: {
293
293
  ml: 0.5,
@@ -297,7 +297,7 @@ function SubscriptionPlan({
297
297
  })
298
298
  }), !feature.description && /*#__PURE__*/(0, _jsxRuntime.jsx)(PlanFeaturesListItemLabel, {
299
299
  variant: "subtitle2",
300
- children: feature.label
300
+ children: t(feature.label)
301
301
  })]
302
302
  }, `${displayPlan.title}-benefits-${index}`))
303
303
  }), plan.button && /*#__PURE__*/(0, _jsxRuntime.jsx)(PlanButton, {
@@ -306,7 +306,7 @@ function SubscriptionPlan({
306
306
  color: plan.button.buttonColor || "primary",
307
307
  onClick: () => plan.button.onClick(),
308
308
  bgPrimary: plan.bgPrimary,
309
- children: plan.button.buttonText
309
+ children: t(plan.button.buttonText)
310
310
  }), displayPlan && billingPeriod && currency && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
311
311
  mt: 2,
312
312
  children: [plan.planVersions && displayPlan.subButton && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -322,7 +322,7 @@ function SubscriptionPlan({
322
322
  "aria-controls": open ? "demo-positioned-menu" : undefined,
323
323
  "aria-haspopup": "true",
324
324
  "aria-expanded": open ? "true" : "false",
325
- children: plan.subButton.buttonText
325
+ children: t(plan.subButton.buttonText)
326
326
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
327
327
  alignItems: "center",
328
328
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Menu, {
@@ -350,7 +350,7 @@ function SubscriptionPlan({
350
350
  sx: {
351
351
  margin: 2
352
352
  },
353
- children: [getPriceList(i), " ", currentPlan.title, " - Up to", " ", currentPlan.students, " Students"]
353
+ children: [getPriceList(i), " ", t(currentPlan.title), " - Up to", " ", t(currentPlan.students), " Students"]
354
354
  })
355
355
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
356
356
  "aria-label": "close",
@@ -378,11 +378,11 @@ function SubscriptionPlan({
378
378
  disabled: buyNowDisabled,
379
379
  onClick: () => displayPlan.buyButton.onClick(displayPlan, currency, billingPeriod),
380
380
  bgPrimary: displayPlan.bgPrimary,
381
- children: displayPlan.buyButton.buttonText
381
+ children: t(displayPlan.buyButton.buttonText)
382
382
  })]
383
383
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactMarkdown.default, {
384
384
  className: classes.planFootnote,
385
- children: displayPlan.footnote
385
+ children: t(displayPlan.footnote)
386
386
  })]
387
387
  })
388
388
  }), displayPlan && displayPlan.nuala && /*#__PURE__*/(0, _jsxRuntime.jsx)(Nuala, {