@nualang/nualang-ui-components 0.1.1265 → 0.1.1267

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 (149) hide show
  1. package/README.md +64 -64
  2. package/dist/Assignments/AssignmentBotSelection/AssignmentBotSelection.js +28 -4
  3. package/dist/Assignments/AssignmentCourseSelection/AssignmentCourseSelection.js +11 -3
  4. package/dist/Assignments/AssignmentExerciseSelection/AssignmentExerciseSelection.js +71 -11
  5. package/dist/Assignments/AssignmentExerciseSelector/AssignmentExerciseSelector.js +6 -2
  6. package/dist/Assignments/AssignmentRoleplaySelection/AssignmentRoleplaySelection.js +37 -3
  7. package/dist/Assignments/CreateAssignmentDialog/CreateAssignmentDialog.js +7 -1
  8. package/dist/Cards/Course/Course.js +1 -1
  9. package/dist/Cards/SubscriptionPlan/nuala.svg +28 -28
  10. package/dist/Cards/SubscriptionPlan/plus.svg +4 -4
  11. package/dist/Chat/BottomBar/BottomBar.js +1 -0
  12. package/dist/Dialogs/GenerateBot/GenerateBot.js +5 -1
  13. package/dist/Dialogs/GeneratePhrases/GeneratePhrases.js +5 -1
  14. package/dist/Dialogs/GenerateRoleplay/GenerateRoleplay.js +5 -1
  15. package/dist/Lists/Leaderboard/Leaderboard.js +16 -17
  16. package/dist/Lists/Phrases/Phrases.js +79 -2
  17. package/dist/hooks/useExerciseState.js +1 -1
  18. package/dist/img/0-nuala-001.svg +34 -34
  19. package/dist/img/1-teacher-001.svg +38 -38
  20. package/dist/img/AudioNuala.svg +165 -165
  21. package/dist/img/Bronze Medal.svg +545 -545
  22. package/dist/img/Bronze.svg +349 -349
  23. package/dist/img/BronzeBadge.svg +493 -493
  24. package/dist/img/BronzeBadgeWithoutRibbon.svg +317 -317
  25. package/dist/img/Frame 51.svg +98 -98
  26. package/dist/img/Frame 52.svg +131 -131
  27. package/dist/img/Frame 53.svg +139 -139
  28. package/dist/img/Gold Badge.svg +362 -362
  29. package/dist/img/Gold Medal.svg +481 -481
  30. package/dist/img/GoldBadge.svg +470 -470
  31. package/dist/img/GoldBadgeWithoutRibbon.svg +324 -324
  32. package/dist/img/NewText.svg +5 -5
  33. package/dist/img/NualaCreateImage.svg +129 -129
  34. package/dist/img/NualangLiveAnswerQuickly.svg +103 -103
  35. package/dist/img/NualangLiveAnwerQuicklyListening.svg +3607 -3607
  36. package/dist/img/NualangLiveListen.svg +42 -42
  37. package/dist/img/NualangLiveListenToPhrase.svg +4285 -4285
  38. package/dist/img/NualangLivePickAnswer.svg +134 -134
  39. package/dist/img/NualangLiveResult.svg +1235 -1235
  40. package/dist/img/NualangLiveRoleplayAnswer.svg +334 -334
  41. package/dist/img/NualangLiveRoleplayConvo.svg +282 -282
  42. package/dist/img/NualangLiveSeePlace.svg +134 -134
  43. package/dist/img/NualangLiveTranslate.svg +54 -54
  44. package/dist/img/NualangLiveTranslateQuickly.svg +197 -197
  45. package/dist/img/NualangLiveViewConversations.svg +135 -135
  46. package/dist/img/Polly.svg +17 -17
  47. package/dist/img/Silver Badge.svg +523 -523
  48. package/dist/img/Silver Medal.svg +549 -549
  49. package/dist/img/SilverBadge.svg +655 -655
  50. package/dist/img/SilverBadgeWithoutRibbon.svg +491 -491
  51. package/dist/img/avatars/0-nuala-001.svg +34 -34
  52. package/dist/img/avatars/0-nuala-002.svg +25 -25
  53. package/dist/img/avatars/0-nuala-003.svg +27 -27
  54. package/dist/img/avatars/0-nuala-004.svg +41 -41
  55. package/dist/img/avatars/0-nuala-005.svg +33 -33
  56. package/dist/img/avatars/0-nuala-006.svg +32 -32
  57. package/dist/img/avatars/0-nuala-007.svg +37 -37
  58. package/dist/img/avatars/0-nuala-008.svg +21 -21
  59. package/dist/img/avatars/0-nuala-009.svg +21 -21
  60. package/dist/img/avatars/0-nuala-010.svg +39 -39
  61. package/dist/img/avatars/0-nuala-011.svg +33 -33
  62. package/dist/img/avatars/0-nuala-012.svg +43 -43
  63. package/dist/img/avatars/0-nuala-013.svg +36 -36
  64. package/dist/img/avatars/0-nuala-014.svg +30 -30
  65. package/dist/img/avatars/0-nuala-015.svg +28 -28
  66. package/dist/img/avatars/0-nuala-016.svg +24 -24
  67. package/dist/img/avatars/0-nuala-017.svg +31 -31
  68. package/dist/img/avatars/0-nuala-018.svg +29 -29
  69. package/dist/img/avatars/0-nuala-019.svg +57 -57
  70. package/dist/img/avatars/0-nuala-020.svg +30 -30
  71. package/dist/img/avatars/0-nuala-021.svg +28 -28
  72. package/dist/img/avatars/1-teacher-001.svg +38 -38
  73. package/dist/img/avatars/1-teacher-002.svg +52 -52
  74. package/dist/img/avatars/1-teacher-003.svg +86 -86
  75. package/dist/img/avatars/nuala_10_celebrating.svg +44 -44
  76. package/dist/img/avatars/nuala_10_speaking.svg +45 -45
  77. package/dist/img/avatars/nuala_11_celebrating.svg +38 -38
  78. package/dist/img/avatars/nuala_11_speaking.svg +41 -41
  79. package/dist/img/avatars/nuala_12_celebrating.svg +48 -48
  80. package/dist/img/avatars/nuala_12_speaking.svg +49 -49
  81. package/dist/img/avatars/nuala_13_celebrating.svg +41 -41
  82. package/dist/img/avatars/nuala_13_speaking.svg +44 -44
  83. package/dist/img/avatars/nuala_14_celebrating.svg +35 -35
  84. package/dist/img/avatars/nuala_14_speaking.svg +36 -36
  85. package/dist/img/avatars/nuala_15_celebrating.svg +33 -33
  86. package/dist/img/avatars/nuala_15_speaking.svg +36 -36
  87. package/dist/img/avatars/nuala_16_celebrating.svg +29 -29
  88. package/dist/img/avatars/nuala_16_speaking.svg +32 -32
  89. package/dist/img/avatars/nuala_17_celebrating.svg +36 -36
  90. package/dist/img/avatars/nuala_17_speaking.svg +39 -39
  91. package/dist/img/avatars/nuala_18_celebrating.svg +34 -34
  92. package/dist/img/avatars/nuala_18_speaking.svg +37 -37
  93. package/dist/img/avatars/nuala_19_celebrating.svg +62 -62
  94. package/dist/img/avatars/nuala_19_speaking.svg +65 -65
  95. package/dist/img/avatars/nuala_1_celebrating.svg +30 -30
  96. package/dist/img/avatars/nuala_1_speaking.svg +37 -37
  97. package/dist/img/avatars/nuala_20_celebrating.svg +35 -35
  98. package/dist/img/avatars/nuala_20_speaking.svg +38 -38
  99. package/dist/img/avatars/nuala_21_celebrating.svg +33 -33
  100. package/dist/img/avatars/nuala_21_speaking.svg +36 -36
  101. package/dist/img/avatars/nuala_2_celebrating.svg +21 -21
  102. package/dist/img/avatars/nuala_2_speaking.svg +29 -29
  103. package/dist/img/avatars/nuala_3_celebrating.svg +20 -20
  104. package/dist/img/avatars/nuala_3_speaking.svg +28 -28
  105. package/dist/img/avatars/nuala_4_celebrating.svg +33 -33
  106. package/dist/img/avatars/nuala_4_speaking.svg +41 -41
  107. package/dist/img/avatars/nuala_5_celebrating.svg +30 -30
  108. package/dist/img/avatars/nuala_5_speaking.svg +36 -36
  109. package/dist/img/avatars/nuala_6_celebrating.svg +37 -37
  110. package/dist/img/avatars/nuala_6_speaking.svg +36 -36
  111. package/dist/img/avatars/nuala_7_celebrating.svg +42 -42
  112. package/dist/img/avatars/nuala_7_speaking.svg +43 -43
  113. package/dist/img/avatars/nuala_8_celebrating.svg +26 -26
  114. package/dist/img/avatars/nuala_8_speaking.svg +29 -29
  115. package/dist/img/avatars/nuala_9_celebrating.svg +26 -26
  116. package/dist/img/avatars/nuala_9_speaking.svg +27 -27
  117. package/dist/img/aws.svg +5 -5
  118. package/dist/img/azure.svg +9 -9
  119. package/dist/img/bot-error.svg +28 -28
  120. package/dist/img/bot_nuala.svg +45 -45
  121. package/dist/img/classroom.svg +178 -178
  122. package/dist/img/course.svg +113 -113
  123. package/dist/img/dashboard.svg +103 -103
  124. package/dist/img/nuala_1_celebrating.svg +33 -33
  125. package/dist/img/nuala_2_celebrating.svg +20 -20
  126. package/dist/img/nuala_3_celebrating.svg +21 -21
  127. package/dist/img/nuala_4_celebrating.svg +30 -30
  128. package/dist/img/nuala_5_celebrating.svg +30 -30
  129. package/dist/img/nuala_celebrating.svg +39 -39
  130. package/dist/img/nuala_sign_in.svg +62 -62
  131. package/dist/img/nuala_speaking.svg +41 -41
  132. package/dist/img/nuala_speaking_2.svg +41 -41
  133. package/dist/img/nuala_speaking_3.svg +41 -41
  134. package/dist/img/nuala_speaking_4.svg +41 -41
  135. package/dist/img/nualang-logo-primary.svg +17 -17
  136. package/dist/img/nualangSquareIcon.svg +18 -18
  137. package/dist/img/nualas.svg +185 -185
  138. package/dist/img/sentiment_dissatisfied_24px.svg +3 -3
  139. package/dist/img/sentiment_satisfied_24px.svg +3 -3
  140. package/dist/img/sentiment_very_satisfied_24px.svg +3 -3
  141. package/dist/img/stars1.svg +44 -44
  142. package/dist/img/stars2.svg +30 -30
  143. package/dist/img/structuring.svg +76 -76
  144. package/dist/img/teacher-create-2.svg +81 -81
  145. package/dist/img/teacher-create.svg +49 -49
  146. package/dist/img/teacher-world.svg +271 -271
  147. package/dist/img/teacher.svg +89 -89
  148. package/dist/img/world.svg +41 -41
  149. package/package.json +190 -190
package/README.md CHANGED
@@ -1,65 +1,65 @@
1
- # Nualang ui-components
2
- This is the ui-components repository for the Nualang product. The components
3
- are developed, reviewed and tested with storybook and a library is then published
4
- to `npm` and consumed from there by nualang web apps.
5
-
6
- ## Getting Started
7
- Clone this repository and then execute `npm install`. `npm start` will start
8
- [stoybook](https://storybook.js.org) and allow you to brrowse the available components.
9
-
10
- ## Develop
11
- ```
12
- npm start
13
- ```
14
-
15
- ## Create Local Package
16
- Compile and pack (This will create a '.tgz' file):
17
- ```
18
- npm run localpack
19
- ```
20
-
21
- Install package (Inside webapp):
22
- ```
23
- npm i ../ui-components/fathomtech-nualang-ui-components-0.1.XXX.tgz
24
- ```
25
-
26
- If webapp is caching previous versions (Add a character to the end of the .tgz, e.g 'a') and install again:
27
- ```
28
- yarn add ../ui-components/fathomtech-nualang-ui-components-0.1.XXXa.tgz
29
- ```
30
-
31
- ## Publish to npm
32
- Make sure that the version number has been updayed in package.json.
33
- Ensure that you have committed the latest version to git.
34
- Execute:-
35
- ```bash
36
- npm run postversion
37
- ```
38
- npm will complain if you try to re-publish a previously used version number.
39
-
40
-
41
- ## Additional Scripts
42
- In the project directory, you can run:
43
-
44
- ### `npm run storybook`
45
- Runs the app in the development mode.<br />
46
- Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
47
-
48
- The page will reload if you make edits.<br />
49
- You should also see any lint errors in the console.
50
-
51
- ### `npm run test`
52
- Launches the test runner in interactive watch mode.<br />
53
- See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
54
-
55
- ### `npm run lint`
56
- Check for any lint errors or warnings.
57
-
58
- ### `npm run compile`
59
- Run the babel compiler to compile es6 to js.
60
-
61
- ### `npm run postversion`
62
- Publish a new version of the pacakage to npm. npm will complain
63
-
64
- ### `npm run chromatic`
1
+ # Nualang ui-components
2
+ This is the ui-components repository for the Nualang product. The components
3
+ are developed, reviewed and tested with storybook and a library is then published
4
+ to `npm` and consumed from there by nualang web apps.
5
+
6
+ ## Getting Started
7
+ Clone this repository and then execute `npm install`. `npm start` will start
8
+ [stoybook](https://storybook.js.org) and allow you to brrowse the available components.
9
+
10
+ ## Develop
11
+ ```
12
+ npm start
13
+ ```
14
+
15
+ ## Create Local Package
16
+ Compile and pack (This will create a '.tgz' file):
17
+ ```
18
+ npm run localpack
19
+ ```
20
+
21
+ Install package (Inside webapp):
22
+ ```
23
+ npm i ../ui-components/fathomtech-nualang-ui-components-0.1.XXX.tgz
24
+ ```
25
+
26
+ If webapp is caching previous versions (Add a character to the end of the .tgz, e.g 'a') and install again:
27
+ ```
28
+ yarn add ../ui-components/fathomtech-nualang-ui-components-0.1.XXXa.tgz
29
+ ```
30
+
31
+ ## Publish to npm
32
+ Make sure that the version number has been updayed in package.json.
33
+ Ensure that you have committed the latest version to git.
34
+ Execute:-
35
+ ```bash
36
+ npm run postversion
37
+ ```
38
+ npm will complain if you try to re-publish a previously used version number.
39
+
40
+
41
+ ## Additional Scripts
42
+ In the project directory, you can run:
43
+
44
+ ### `npm run storybook`
45
+ Runs the app in the development mode.<br />
46
+ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
47
+
48
+ The page will reload if you make edits.<br />
49
+ You should also see any lint errors in the console.
50
+
51
+ ### `npm run test`
52
+ Launches the test runner in interactive watch mode.<br />
53
+ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
54
+
55
+ ### `npm run lint`
56
+ Check for any lint errors or warnings.
57
+
58
+ ### `npm run compile`
59
+ Run the babel compiler to compile es6 to js.
60
+
61
+ ### `npm run postversion`
62
+ Publish a new version of the pacakage to npm. npm will complain
63
+
64
+ ### `npm run chromatic`
65
65
  Publish a new version of the pacakage to https://www.chromatic.com/
@@ -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
- return bots.map((bot, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Bot, {
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.ListItemIcon, {
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.ListItemIcon, {
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" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {}), !isCreator && name.toLowerCase() === "pronunciation" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
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.ListItemIcon, {
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 => selectedTopicIds.includes(topic.topicId)));
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.ListItemIcon, {
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, {
@@ -92,7 +92,7 @@ function OverflowMenu({
92
92
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
93
93
  children: t("leave_course")
94
94
  })]
95
- }), classroomId && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
95
+ }), isCreator && classroomId && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
96
96
  onClick: () => {
97
97
  localStorage.setItem("focusCourseSettings", true);
98
98
  window.location.hash = "Settings";