@nualang/nualang-ui-components 0.1.1242 → 0.1.1243

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 (175) hide show
  1. package/README.md +64 -64
  2. package/dist/Assignments/AssignmentBotSelection/AssignmentBotSelection.js +177 -0
  3. package/dist/Assignments/AssignmentBotSelection/package.json +7 -0
  4. package/dist/Assignments/AssignmentCard/AssignmentCard.js +28 -13
  5. package/dist/Assignments/AssignmentCard/package.json +6 -6
  6. package/dist/Assignments/AssignmentCardsList/AssignmentCardsList.js +3 -1
  7. package/dist/Assignments/AssignmentCardsList/package.json +6 -6
  8. package/dist/Assignments/AssignmentCourseSelection/AssignmentCourseSelection.js +106 -76
  9. package/dist/Assignments/AssignmentCourseSelection/package.json +6 -6
  10. package/dist/Assignments/AssignmentExerciseSelection/AssignmentExerciseSelection.js +79 -12
  11. package/dist/Assignments/AssignmentExerciseSelection/package.json +6 -6
  12. package/dist/Assignments/AssignmentExerciseSelector/AssignmentExerciseSelector.js +2 -0
  13. package/dist/Assignments/AssignmentExerciseSelector/package.json +6 -6
  14. package/dist/Assignments/AssignmentRoleplaySelection/package.json +6 -6
  15. package/dist/Assignments/AssignmentSelectExercise/AssignmentSelectExercise.js +25 -6
  16. package/dist/Assignments/CreateAssignmentDialog/CreateAssignmentDialog.js +3 -0
  17. package/dist/Assignments/CreateAssignmentDialog/package.json +6 -6
  18. package/dist/Assignments/SelectAssignmentTypeDialog/package.json +6 -6
  19. package/dist/Cards/SubscriptionPlan/nuala.svg +28 -28
  20. package/dist/Cards/SubscriptionPlan/plus.svg +4 -4
  21. package/dist/Charts/Bar/TotalGrades/package.json +6 -6
  22. package/dist/Dialogs/AvatarDialog/AvatarDialog.js +12 -9
  23. package/dist/Dialogs/GenerateBot/package.json +6 -6
  24. package/dist/Dialogs/UploadPhrases/UploadPhrases.js +6 -6
  25. package/dist/Dialogs/UploadRoleplayScript/UploadRoleplayScript.js +11 -11
  26. package/dist/Editors/Bot/Editor/BotFlow/BotFlow.js +3 -3
  27. package/dist/Editors/Phrases/Phrases.js +2 -2
  28. package/dist/Exercises/Bot/Bot.js +24 -9
  29. package/dist/Forms/DiscussImageSelector/package.json +6 -6
  30. package/dist/Forms/DiscussMultiStepFormDialog/package.json +6 -6
  31. package/dist/Lists/Categories/package.json +6 -6
  32. package/dist/Misc/AxiosRestExample/AxiosRestExample.js +3 -3
  33. package/dist/Misc/AxiosRestExample/AxiosRestPostExample.js +6 -6
  34. package/dist/Misc/ColorLinearProgress/package.json +6 -6
  35. package/dist/Misc/NualaCreating/styles.css +68 -68
  36. package/dist/Navigation/ResponsiveTabs/ResponsiveTabs.js +3 -2
  37. package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +40 -10
  38. package/dist/Screens/Search/package.json +6 -6
  39. package/dist/Tables/Progress/ProgressList.js +3 -3
  40. package/dist/hooks/useRecognition.js +6 -6
  41. package/dist/hooks/useSpreadsheetState.js +7 -7
  42. package/dist/img/0-nuala-001.svg +34 -34
  43. package/dist/img/1-teacher-001.svg +38 -38
  44. package/dist/img/AudioNuala.svg +165 -165
  45. package/dist/img/Bronze Medal.svg +545 -545
  46. package/dist/img/Bronze.svg +349 -349
  47. package/dist/img/BronzeBadge.svg +493 -493
  48. package/dist/img/BronzeBadgeWithoutRibbon.svg +317 -317
  49. package/dist/img/Frame 51.svg +98 -98
  50. package/dist/img/Frame 52.svg +131 -131
  51. package/dist/img/Frame 53.svg +139 -139
  52. package/dist/img/Gold Badge.svg +362 -362
  53. package/dist/img/Gold Medal.svg +481 -481
  54. package/dist/img/GoldBadge.svg +470 -470
  55. package/dist/img/GoldBadgeWithoutRibbon.svg +324 -324
  56. package/dist/img/NewText.svg +5 -5
  57. package/dist/img/NualaCreateImage.svg +129 -129
  58. package/dist/img/NualangLiveAnswerQuickly.svg +103 -103
  59. package/dist/img/NualangLiveAnwerQuicklyListening.svg +3607 -3607
  60. package/dist/img/NualangLiveListen.svg +42 -42
  61. package/dist/img/NualangLiveListenToPhrase.svg +4285 -4285
  62. package/dist/img/NualangLivePickAnswer.svg +134 -134
  63. package/dist/img/NualangLiveResult.svg +1235 -1235
  64. package/dist/img/NualangLiveRoleplayAnswer.svg +334 -334
  65. package/dist/img/NualangLiveRoleplayConvo.svg +282 -282
  66. package/dist/img/NualangLiveSeePlace.svg +134 -134
  67. package/dist/img/NualangLiveTranslate.svg +54 -54
  68. package/dist/img/NualangLiveTranslateQuickly.svg +197 -197
  69. package/dist/img/NualangLiveViewConversations.svg +135 -135
  70. package/dist/img/Polly.svg +17 -17
  71. package/dist/img/Silver Badge.svg +523 -523
  72. package/dist/img/Silver Medal.svg +549 -549
  73. package/dist/img/SilverBadge.svg +655 -655
  74. package/dist/img/SilverBadgeWithoutRibbon.svg +491 -491
  75. package/dist/img/avatars/0-nuala-001.svg +34 -34
  76. package/dist/img/avatars/0-nuala-002.svg +25 -25
  77. package/dist/img/avatars/0-nuala-003.svg +27 -27
  78. package/dist/img/avatars/0-nuala-004.svg +41 -41
  79. package/dist/img/avatars/0-nuala-005.svg +33 -33
  80. package/dist/img/avatars/0-nuala-006.svg +32 -32
  81. package/dist/img/avatars/0-nuala-007.svg +37 -37
  82. package/dist/img/avatars/0-nuala-008.svg +21 -21
  83. package/dist/img/avatars/0-nuala-009.svg +21 -21
  84. package/dist/img/avatars/0-nuala-010.svg +39 -39
  85. package/dist/img/avatars/0-nuala-011.svg +33 -33
  86. package/dist/img/avatars/0-nuala-012.svg +43 -43
  87. package/dist/img/avatars/0-nuala-013.svg +36 -36
  88. package/dist/img/avatars/0-nuala-014.svg +30 -30
  89. package/dist/img/avatars/0-nuala-015.svg +28 -28
  90. package/dist/img/avatars/0-nuala-016.svg +24 -24
  91. package/dist/img/avatars/0-nuala-017.svg +31 -31
  92. package/dist/img/avatars/0-nuala-018.svg +29 -29
  93. package/dist/img/avatars/0-nuala-019.svg +57 -57
  94. package/dist/img/avatars/0-nuala-020.svg +30 -30
  95. package/dist/img/avatars/0-nuala-021.svg +28 -28
  96. package/dist/img/avatars/1-teacher-001.svg +38 -38
  97. package/dist/img/avatars/1-teacher-002.svg +52 -52
  98. package/dist/img/avatars/1-teacher-003.svg +86 -86
  99. package/dist/img/avatars/nuala_10_celebrating.svg +44 -44
  100. package/dist/img/avatars/nuala_10_speaking.svg +45 -45
  101. package/dist/img/avatars/nuala_11_celebrating.svg +38 -38
  102. package/dist/img/avatars/nuala_11_speaking.svg +41 -41
  103. package/dist/img/avatars/nuala_12_celebrating.svg +48 -48
  104. package/dist/img/avatars/nuala_12_speaking.svg +49 -49
  105. package/dist/img/avatars/nuala_13_celebrating.svg +41 -41
  106. package/dist/img/avatars/nuala_13_speaking.svg +44 -44
  107. package/dist/img/avatars/nuala_14_celebrating.svg +35 -35
  108. package/dist/img/avatars/nuala_14_speaking.svg +36 -36
  109. package/dist/img/avatars/nuala_15_celebrating.svg +33 -33
  110. package/dist/img/avatars/nuala_15_speaking.svg +36 -36
  111. package/dist/img/avatars/nuala_16_celebrating.svg +29 -29
  112. package/dist/img/avatars/nuala_16_speaking.svg +32 -32
  113. package/dist/img/avatars/nuala_17_celebrating.svg +36 -36
  114. package/dist/img/avatars/nuala_17_speaking.svg +39 -39
  115. package/dist/img/avatars/nuala_18_celebrating.svg +34 -34
  116. package/dist/img/avatars/nuala_18_speaking.svg +37 -37
  117. package/dist/img/avatars/nuala_19_celebrating.svg +62 -62
  118. package/dist/img/avatars/nuala_19_speaking.svg +65 -65
  119. package/dist/img/avatars/nuala_1_celebrating.svg +30 -30
  120. package/dist/img/avatars/nuala_1_speaking.svg +37 -37
  121. package/dist/img/avatars/nuala_20_celebrating.svg +35 -35
  122. package/dist/img/avatars/nuala_20_speaking.svg +38 -38
  123. package/dist/img/avatars/nuala_21_celebrating.svg +33 -33
  124. package/dist/img/avatars/nuala_21_speaking.svg +36 -36
  125. package/dist/img/avatars/nuala_2_celebrating.svg +21 -21
  126. package/dist/img/avatars/nuala_2_speaking.svg +29 -29
  127. package/dist/img/avatars/nuala_3_celebrating.svg +20 -20
  128. package/dist/img/avatars/nuala_3_speaking.svg +28 -28
  129. package/dist/img/avatars/nuala_4_celebrating.svg +33 -33
  130. package/dist/img/avatars/nuala_4_speaking.svg +41 -41
  131. package/dist/img/avatars/nuala_5_celebrating.svg +30 -30
  132. package/dist/img/avatars/nuala_5_speaking.svg +36 -36
  133. package/dist/img/avatars/nuala_6_celebrating.svg +37 -37
  134. package/dist/img/avatars/nuala_6_speaking.svg +36 -36
  135. package/dist/img/avatars/nuala_7_celebrating.svg +42 -42
  136. package/dist/img/avatars/nuala_7_speaking.svg +43 -43
  137. package/dist/img/avatars/nuala_8_celebrating.svg +26 -26
  138. package/dist/img/avatars/nuala_8_speaking.svg +29 -29
  139. package/dist/img/avatars/nuala_9_celebrating.svg +26 -26
  140. package/dist/img/avatars/nuala_9_speaking.svg +27 -27
  141. package/dist/img/aws.svg +5 -5
  142. package/dist/img/azure.svg +9 -9
  143. package/dist/img/bot-error.svg +28 -28
  144. package/dist/img/bot_nuala.svg +45 -45
  145. package/dist/img/classroom.svg +178 -178
  146. package/dist/img/course.svg +113 -113
  147. package/dist/img/dashboard.svg +103 -103
  148. package/dist/img/nuala_1_celebrating.svg +33 -33
  149. package/dist/img/nuala_2_celebrating.svg +20 -20
  150. package/dist/img/nuala_3_celebrating.svg +21 -21
  151. package/dist/img/nuala_4_celebrating.svg +30 -30
  152. package/dist/img/nuala_5_celebrating.svg +30 -30
  153. package/dist/img/nuala_celebrating.svg +39 -39
  154. package/dist/img/nuala_sign_in.svg +62 -62
  155. package/dist/img/nuala_speaking.svg +41 -41
  156. package/dist/img/nuala_speaking_2.svg +41 -41
  157. package/dist/img/nuala_speaking_3.svg +41 -41
  158. package/dist/img/nuala_speaking_4.svg +41 -41
  159. package/dist/img/nualang-logo-primary.svg +17 -17
  160. package/dist/img/nualangSquareIcon.svg +18 -18
  161. package/dist/img/nualas.svg +185 -185
  162. package/dist/img/sentiment_dissatisfied_24px.svg +3 -3
  163. package/dist/img/sentiment_satisfied_24px.svg +3 -3
  164. package/dist/img/sentiment_very_satisfied_24px.svg +3 -3
  165. package/dist/img/stars1.svg +44 -44
  166. package/dist/img/stars2.svg +30 -30
  167. package/dist/img/structuring.svg +76 -76
  168. package/dist/img/teacher-create-2.svg +81 -81
  169. package/dist/img/teacher-create.svg +49 -49
  170. package/dist/img/teacher-world.svg +271 -271
  171. package/dist/img/teacher.svg +89 -89
  172. package/dist/img/world.svg +41 -41
  173. package/dist/utils/canvasUtils.js +5 -5
  174. package/dist/utils/index.js +8 -8
  175. package/package.json +185 -185
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/
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.InProgressBadge = InProgressBadge;
7
+ exports.ProgressBadge = ProgressBadge;
8
+ exports.default = void 0;
9
+ var _react = require("react");
10
+ var _material = require("@mui/material");
11
+ var _iconsMaterial = require("@mui/icons-material");
12
+ var _reactRouterDom = require("react-router-dom");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ const sxGreenColor = theme => ({
15
+ color: theme.palette.success ? theme.palette.success.dark : ""
16
+ });
17
+ const sxInfoColor = theme => ({
18
+ color: theme.palette.info ? theme.palette.info.main : ""
19
+ });
20
+ function ProgressBadge({
21
+ completions
22
+ }) {
23
+ return completions > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Badge, {
24
+ sx: sxGreenColor,
25
+ badgeContent: completions,
26
+ color: "default",
27
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Done, {})
28
+ }) : null;
29
+ }
30
+ function InProgressBadge({
31
+ progressCount
32
+ }) {
33
+ return progressCount > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Badge, {
34
+ sx: sxInfoColor,
35
+ color: "default",
36
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Timelapse, {})
37
+ }) : null;
38
+ }
39
+ function Bot({
40
+ bot,
41
+ courseSectionTopicId,
42
+ isBotSelected,
43
+ t,
44
+ isExerciseSelected,
45
+ handleSelectExercise = null,
46
+ selectedExercises,
47
+ useCase,
48
+ assignment,
49
+ lastClickedExerciseId,
50
+ memberCourseCompletions,
51
+ topicProgress,
52
+ isCreator
53
+ }) {
54
+ const navigate = (0, _reactRouterDom.useNavigate)();
55
+ const params = (0, _reactRouterDom.useParams)();
56
+ const {
57
+ classroomId
58
+ } = params;
59
+ const [courseId, sectionId, topicId] = courseSectionTopicId ? courseSectionTopicId.split("|") : "";
60
+ const [lasClickedCourseId, lasClickedSectionId, lasClickedTopicId, lastClickedAssignmentId, lastClickedBotId] = lastClickedExerciseId?.split("|") || [];
61
+ const addSearchParams = () => {
62
+ if (!classroomId || !courseId || !sectionId || !topicId || !bot?.botId) {
63
+ console.error("Missing required parameters for navigation");
64
+ return;
65
+ }
66
+ const lastClickedExercise = {
67
+ courseSectionTopicId: `${courseSectionTopicId}|${assignment.assignmentId}|${bot.botId}`
68
+ };
69
+ localStorage.setItem("lastClickedExercise", JSON.stringify(lastClickedExercise));
70
+ navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}/bots/${bot?.botId}?assignmentId=${assignment.assignmentId}`);
71
+ };
72
+ const [open, setOpen] = (0, _react.useState)(lastClickedBotId === bot.botId && lastClickedAssignmentId === assignment.assignmentId);
73
+ const [isSelected, setIsSelected] = (0, _react.useState)(false);
74
+ (0, _react.useEffect)(() => {
75
+ // Check if this exercise is selected
76
+ const exerciseSelected = selectedExercises?.some(exercise => exercise.botId === bot.botId);
77
+ setIsSelected(exerciseSelected);
78
+ }, [selectedExercises, bot.botId]);
79
+ const handleClick = () => {
80
+ setIsSelected(!isSelected);
81
+ const exercise = {
82
+ botId: bot.botId,
83
+ courseSectionTopicId
84
+ };
85
+ handleSelectExercise([exercise]);
86
+ };
87
+ const getBotCompletion = () => {
88
+ if (!Array.isArray(memberCourseCompletions) || memberCourseCompletions.length === 0) {
89
+ return 0;
90
+ }
91
+ const botCompletion = memberCourseCompletions.filter(completion => completion.botId === bot.botId);
92
+ return botCompletion.length;
93
+ };
94
+ const getBotProgress = () => {
95
+ const progress = topicProgress?.filter(progress => progress.botId === bot.botId && progress.existingMessages && progress.existingMessages !== null);
96
+ return progress?.length || 0;
97
+ };
98
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
99
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
100
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
101
+ onClick: () => {
102
+ if (useCase === "assignment-start") {
103
+ addSearchParams();
104
+ } else if (handleSelectExercise) {
105
+ handleClick();
106
+ }
107
+ },
108
+ sx: {
109
+ display: "flex",
110
+ alignItems: "center",
111
+ justifyContent: "space-between",
112
+ flexDirection: {
113
+ xs: "column",
114
+ sm: "row"
115
+ }
116
+ },
117
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
118
+ display: "flex",
119
+ alignItems: "center",
120
+ width: {
121
+ xs: "100%",
122
+ sm: "85%"
123
+ },
124
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
125
+ src: bot.picture
126
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
127
+ primary: bot.botName,
128
+ secondary: bot.description,
129
+ sx: {
130
+ marginLeft: 2
131
+ }
132
+ })]
133
+ }), useCase === "assignment-select" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
134
+ checked: isSelected,
135
+ onClick: e => {
136
+ e.stopPropagation();
137
+ handleClick();
138
+ }
139
+ }), useCase === "assignment-start" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemIcon, {
140
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(InProgressBadge, {
141
+ progressCount: getBotProgress()
142
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ProgressBadge, {
143
+ completions: getBotCompletion()
144
+ })]
145
+ })]
146
+ })
147
+ })
148
+ });
149
+ }
150
+ function AssignmentBotSelection({
151
+ bots = [],
152
+ courseSectionTopicId,
153
+ t,
154
+ isExerciseSelected,
155
+ handleSelectExercise,
156
+ selectedExercises,
157
+ useCase,
158
+ assignment,
159
+ lastClickedExerciseId,
160
+ memberCourseCompletions,
161
+ topicProgress
162
+ }) {
163
+ return bots.map((bot, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Bot, {
164
+ bot: bot,
165
+ courseSectionTopicId: courseSectionTopicId,
166
+ t: t,
167
+ isExerciseSelected: isExerciseSelected,
168
+ handleSelectExercise: handleSelectExercise,
169
+ selectedExercises: selectedExercises,
170
+ useCase: useCase,
171
+ assignment: assignment,
172
+ lastClickedExerciseId: lastClickedExerciseId,
173
+ memberCourseCompletions: memberCourseCompletions,
174
+ topicProgress: topicProgress
175
+ }, index));
176
+ }
177
+ var _default = exports.default = AssignmentBotSelection;
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "AssignmentBotSelection",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./AssignmentBotSelection.js"
6
+ }
7
+
@@ -33,7 +33,8 @@ function AssignmentCard({
33
33
  memberId,
34
34
  fetchMemberCourseCompletions,
35
35
  lastClickedExerciseId,
36
- handleViewProgress
36
+ handleViewProgress,
37
+ lastAssignmentFetch
37
38
  }) {
38
39
  const [confirm] = (0, _useConfirm.default)(t);
39
40
  const {
@@ -112,6 +113,8 @@ function AssignmentCard({
112
113
  staleTime: 500000
113
114
  });
114
115
  const memberCourseCompletions = (0, _react.useMemo)(() => memberCourseCompletionsQuery.isSuccess && memberCourseCompletionsQuery.data ? memberCourseCompletionsQuery.data : {}, [memberCourseCompletionsQuery.data, memberCourseCompletionsQuery.isSuccess]);
116
+ const lastFetch = lastAssignmentFetch?.current[assignment?.classroomId] || 0;
117
+ const isNew = assignment?.updatedAt > lastFetch && !isCreator;
115
118
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Card, {
116
119
  sx: {
117
120
  display: "flex",
@@ -124,19 +127,31 @@ function AssignmentCard({
124
127
  },
125
128
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
126
129
  container: true,
127
- sx: {
128
- width: '100%'
129
- },
130
130
  spacing: 2,
131
131
  alignItems: "center",
132
132
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
133
- size: "grow",
133
+ item: true,
134
+ xs: true,
134
135
  flexDirection: "column",
135
136
  display: "flex",
136
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
137
- variant: "body1",
138
- component: "div",
139
- children: assignment.title
137
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
138
+ display: "flex",
139
+ alignItems: "center",
140
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
141
+ variant: "body1",
142
+ component: "div",
143
+ children: assignment.title
144
+ }), isNew && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
145
+ ml: 2,
146
+ px: 1,
147
+ py: 0.25,
148
+ bgcolor: "#8300A1",
149
+ color: "white",
150
+ fontSize: "0.75rem",
151
+ borderRadius: 1,
152
+ fontWeight: "bold",
153
+ children: t('NEW')
154
+ })]
140
155
  })
141
156
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
142
157
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
@@ -145,6 +160,7 @@ function AssignmentCard({
145
160
  children: calculateDaysUntilDue(assignment.dueDate, assignment.scheduleDate)
146
161
  })
147
162
  }), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
163
+ item: true,
148
164
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
149
165
  title: t("edit"),
150
166
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.IconButton, {
@@ -200,10 +216,9 @@ function AssignmentCard({
200
216
  })
201
217
  })]
202
218
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
203
- size: {
204
- xs: 3,
205
- md: 2
206
- },
219
+ item: true,
220
+ xs: 3,
221
+ md: 2,
207
222
  children: isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
208
223
  display: "flex",
209
224
  flexDirection: "column",
@@ -1,7 +1,7 @@
1
- {
2
- "name": "AssignmentCard",
3
- "version": "0.0.0",
4
- "private": true,
5
- "main": "./AssignmentCard.js"
6
- }
1
+ {
2
+ "name": "AssignmentCard",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./AssignmentCard.js"
6
+ }
7
7
 
@@ -31,7 +31,8 @@ const AssignmentCardsList = ({
31
31
  progressHelpers,
32
32
  fetchMemberCourseCompletions,
33
33
  memberId,
34
- handleViewProgress
34
+ handleViewProgress,
35
+ lastAssignmentFetch
35
36
  }) => {
36
37
  const [lastClickedExerciseId, setLastClickedExerciseId] = (0, _react.useState)(null);
37
38
  (0, _react.useEffect)(() => {
@@ -133,6 +134,7 @@ const AssignmentCardsList = ({
133
134
  return new Date(assignment.scheduleDate) <= new Date();
134
135
  }).map((assignment, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCard.default, {
135
136
  index: index,
137
+ lastAssignmentFetch: lastAssignmentFetch,
136
138
  assignment: assignment,
137
139
  t: t,
138
140
  isCreator: isCreator,
@@ -1,7 +1,7 @@
1
- {
2
- "name": "AssignmentCardsList",
3
- "version": "0.0.0",
4
- "private": true,
5
- "main": "./AssignmentCardsList.js"
6
- }
1
+ {
2
+ "name": "AssignmentCardsList",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./AssignmentCardsList.js"
6
+ }
7
7
 
@@ -19,6 +19,7 @@ function Course({
19
19
  index,
20
20
  getCourseSections,
21
21
  getRoleplays,
22
+ getBots,
22
23
  username,
23
24
  t = text => text,
24
25
  isExerciseSelected,
@@ -36,8 +37,8 @@ function Course({
36
37
  memberCourseCompletions,
37
38
  lastClickedExerciseId
38
39
  }) {
39
- const numOfIds = lastClickedExerciseId ? lastClickedExerciseId.split('|') : [];
40
- const [open, setOpen] = (0, _react.useState)(lastClickedExerciseId && (numOfIds.length === 4 && lastClickedExerciseId.endsWith(`|${assignment.assignmentId}`) || numOfIds.length === 5 && lastClickedExerciseId.split('|')[3] === assignment.assignmentId));
40
+ const numOfIds = lastClickedExerciseId ? lastClickedExerciseId.split("|") : [];
41
+ const [open, setOpen] = (0, _react.useState)(lastClickedExerciseId && (numOfIds.length === 4 && lastClickedExerciseId.endsWith(`|${assignment.assignmentId}`) || numOfIds.length === 5 && lastClickedExerciseId.split("|")[3] === assignment.assignmentId));
41
42
  const [selectedSectionIds, setSelectedSectionIds] = (0, _react.useState)([]);
42
43
  const [filteredSections, setFilteredSections] = (0, _react.useState)([]);
43
44
  const [courseSectionCompletion, setCourseSectionCompletion] = (0, _react.useState)(null);
@@ -83,95 +84,123 @@ function Course({
83
84
  setCourseSectionCompletion(percentCompletion);
84
85
  }
85
86
  }, [courseSections, memberCourseCompletions, selectedExercises]);
86
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.List, {
87
- disablePadding: true,
88
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
89
- title: isCourseEmpty ? t("course_no_sections") : "",
90
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {
91
- disablePadding: true,
92
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemButton, {
93
- onClick: () => setOpen(!open),
94
- disabled: isCourseEmpty || isExerciseSelected,
95
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
96
- display: "flex",
97
- alignItems: "center",
98
- justifyContent: "space-between",
99
- width: "100%",
100
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
87
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
88
+ children: useCase === "assignment-select" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.List, {
89
+ disablePadding: true,
90
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
91
+ title: isCourseEmpty ? t("course_no_sections") : "",
92
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {
93
+ disablePadding: true,
94
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemButton, {
95
+ onClick: () => setOpen(!open),
96
+ disabled: isCourseEmpty || isExerciseSelected,
97
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
101
98
  display: "flex",
102
99
  alignItems: "center",
103
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
104
- src: course.picture,
105
- alt: ""
106
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
107
- primary: course.courseName,
108
- secondary: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
109
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
110
- variant: "body2",
111
- color: "textSecondary",
112
- children: course.description
113
- }), !isCreator && courseSectionCompletion && courseSectionCompletion !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
114
- mt: 1,
115
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
116
- title: `Completed ${courseSectionCompletion.completed} / ${courseSectionCompletion.total} exercises`,
117
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ColorLinearProgress.default, {
118
- variant: "determinate",
119
- value: courseSectionCompletion.percentage
100
+ justifyContent: "space-between",
101
+ width: "100%",
102
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
103
+ display: "flex",
104
+ alignItems: "center",
105
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
106
+ src: course.picture,
107
+ alt: ""
108
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
109
+ primary: course.courseName,
110
+ secondary: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
111
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
112
+ variant: "body2",
113
+ color: "textSecondary",
114
+ children: course.description
115
+ }), !isCreator && courseSectionCompletion && courseSectionCompletion !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
116
+ mt: 1,
117
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
118
+ title: `Completed ${courseSectionCompletion.completed} / ${courseSectionCompletion.total} exercises`,
119
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ColorLinearProgress.default, {
120
+ variant: "determinate",
121
+ value: courseSectionCompletion.percentage
122
+ })
120
123
  })
121
- })
122
- })]
123
- }),
124
+ })]
125
+ }),
126
+ sx: {
127
+ marginLeft: 2
128
+ }
129
+ })]
130
+ }), open ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {
124
131
  sx: {
125
- marginLeft: 2
132
+ color: "#757575"
133
+ }
134
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {
135
+ sx: {
136
+ color: "#757575"
126
137
  }
127
138
  })]
128
- }), open ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {
129
- sx: {
130
- color: "#757575"
131
- }
132
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {
133
- sx: {
134
- color: "#757575"
135
- }
136
- })]
139
+ })
137
140
  })
138
141
  })
139
- })
140
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Collapse, {
141
- in: open,
142
- timeout: "auto",
143
- unmountOnExit: true,
144
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
145
- ml: 3.5,
146
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentExerciseSelection.default, {
147
- t: t,
148
- sections: viewOnly ? filteredSections : courseSections,
149
- isLoading: sectionsQuery.isLoading,
150
- courseId: course.courseId,
151
- isExerciseSelected: isExerciseSelected,
152
- setIsExerciseSelected: setIsExerciseSelected,
153
- getRoleplays: getRoleplays,
154
- handleSelectExercise: handleSelectExercise,
155
- selectedExercises: selectedExercises,
156
- useCase: useCase,
157
- assignment: assignment,
158
- handleStartExercise: handleStartExercise,
159
- isCreator: isCreator,
160
- viewOnly: viewOnly,
161
- username: username,
162
- preferred_username: preferred_username,
163
- progressHelpers: progressHelpers,
164
- memberCourseCompletions: memberCourseCompletions,
165
- lastClickedExerciseId: lastClickedExerciseId
142
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Collapse, {
143
+ in: open,
144
+ timeout: "auto",
145
+ unmountOnExit: true,
146
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
147
+ ml: 3.5,
148
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentExerciseSelection.default, {
149
+ t: t,
150
+ sections: viewOnly ? filteredSections : courseSections,
151
+ isLoading: sectionsQuery.isLoading,
152
+ courseId: course.courseId,
153
+ isExerciseSelected: isExerciseSelected,
154
+ setIsExerciseSelected: setIsExerciseSelected,
155
+ getRoleplays: getRoleplays,
156
+ handleSelectExercise: handleSelectExercise,
157
+ selectedExercises: selectedExercises,
158
+ useCase: useCase,
159
+ assignment: assignment,
160
+ handleStartExercise: handleStartExercise,
161
+ isCreator: isCreator,
162
+ viewOnly: viewOnly,
163
+ username: username,
164
+ preferred_username: preferred_username,
165
+ progressHelpers: progressHelpers,
166
+ memberCourseCompletions: memberCourseCompletions,
167
+ lastClickedExerciseId: lastClickedExerciseId
168
+ })
166
169
  })
170
+ })]
171
+ }, index) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
172
+ ml: 3.5,
173
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentExerciseSelection.default, {
174
+ t: t,
175
+ sections: viewOnly ? filteredSections : courseSections,
176
+ isLoading: sectionsQuery.isLoading,
177
+ courseId: course.courseId,
178
+ isExerciseSelected: isExerciseSelected,
179
+ setIsExerciseSelected: setIsExerciseSelected,
180
+ getRoleplays: getRoleplays,
181
+ getBots: getBots,
182
+ handleSelectExercise: handleSelectExercise,
183
+ selectedExercises: selectedExercises,
184
+ useCase: useCase,
185
+ assignment: assignment,
186
+ handleStartExercise: handleStartExercise,
187
+ isCreator: isCreator,
188
+ viewOnly: viewOnly,
189
+ username: username,
190
+ preferred_username: preferred_username,
191
+ progressHelpers: progressHelpers,
192
+ memberCourseCompletions: memberCourseCompletions,
193
+ lastClickedExerciseId: lastClickedExerciseId,
194
+ course: course
167
195
  })
168
- })]
169
- }, index);
196
+ })
197
+ });
170
198
  }
171
199
  function AssignmentCourseSelection({
172
200
  courses = [],
173
201
  getCourseSections,
174
202
  getRoleplays,
203
+ getBots,
175
204
  username,
176
205
  t = text => text,
177
206
  isExerciseSelected,
@@ -195,6 +224,7 @@ function AssignmentCourseSelection({
195
224
  index: index,
196
225
  getCourseSections: getCourseSections,
197
226
  getRoleplays: getRoleplays,
227
+ getBots: getBots,
198
228
  username: username,
199
229
  t: t,
200
230
  isExerciseSelected: isExerciseSelected,