@nualang/nualang-ui-components 0.1.1230 → 0.1.1231

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.
@@ -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); }
@@ -27,20 +26,32 @@ function AssignmentCard({
27
26
  isCreator,
28
27
  getCourses,
29
28
  deleteAssignment,
30
- handleEditAssignment,
31
- isExpanded,
32
- setExpandedAssignmentId
29
+ handleEditAssignment
33
30
  }) {
34
31
  const [confirm] = (0, _useConfirm.default)(t);
35
32
  const handleDeleteAssignment = async (classroomId, assignmentId) => {
36
- const confirmed = await confirm(t('delete_assignment'), t('delete_assignment_confirmation'));
33
+ const confirmed = await confirm(t("delete_assignment"), t("delete_assignment_confirmation"));
37
34
  if (confirmed) {
38
35
  await deleteAssignment(classroomId, assignmentId);
39
36
  }
40
37
  };
41
- const calculateDaysUntilDue = dueDate => {
38
+ const calculateDaysUntilDue = (dueDate, scheduledDate) => {
42
39
  const now = new Date();
43
40
  const due = new Date(dueDate);
41
+ const scheduled = new Date(scheduledDate);
42
+ console.log('now', now);
43
+ console.log('due', due);
44
+ console.log('scheduled', scheduled);
45
+ if (scheduled > now) {
46
+ const daysUntilScheduled = Math.ceil((scheduled - now) / (1000 * 60 * 60 * 24));
47
+ if (daysUntilScheduled === 1) {
48
+ return t("available_tomorrow");
49
+ } else if (daysUntilScheduled === 0) {
50
+ return t("available_today");
51
+ } else {
52
+ return `${t("available_in")} ${daysUntilScheduled} ${t("days")}`;
53
+ }
54
+ }
44
55
  const diffTime = due - now;
45
56
  const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
46
57
  if (diffDays < 0) {
@@ -53,10 +64,6 @@ function AssignmentCard({
53
64
  return `${t("due_in")} ${diffDays} ${t("days")}`;
54
65
  }
55
66
  };
56
- const handleIconClick = event => {
57
- event.stopPropagation();
58
- setExpandedAssignmentId(prevId => prevId === assignment.assignmentId ? null : assignment.assignmentId);
59
- };
60
67
  const {
61
68
  uniqueCourses
62
69
  } = (0, _react.useMemo)(() => {
@@ -136,34 +143,32 @@ function AssignmentCard({
136
143
  children: `${Math.round(assignment.completed / assignment.assignedStudents.length * 100)}%`
137
144
  })]
138
145
  })]
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
146
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
153
147
  item: true,
154
148
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
155
149
  variant: "button",
156
150
  color: "text.secondary",
157
- children: calculateDaysUntilDue(assignment.dueDate)
151
+ children: calculateDaysUntilDue(assignment.dueDate, assignment.scheduleDate)
158
152
  })
159
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
153
+ }), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
160
154
  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
- })
155
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
156
+ title: t("edit"),
157
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.IconButton, {
158
+ onClick: () => handleEditAssignment(assignment),
159
+ children: [" ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Edit, {}), " "]
160
+ })
161
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
162
+ title: t("delete"),
163
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.IconButton, {
164
+ onClick: () => {
165
+ handleDeleteAssignment(assignment.classroomId, assignment.assignmentId);
166
+ },
167
+ children: [" ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Delete, {}), " "]
168
+ })
169
+ })]
165
170
  })]
166
- }), isExpanded && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
171
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
167
172
  mt: 2,
168
173
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
169
174
  sx: {
@@ -181,7 +186,7 @@ function AssignmentCard({
181
186
  children: assignment.instructions
182
187
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
183
188
  mt: 2,
184
- width: "80%",
189
+ width: isCreator ? "80%" : "100%",
185
190
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentExerciseSelector.default, {
186
191
  t: t,
187
192
  assignment: assignment,
@@ -198,7 +203,7 @@ function AssignmentCard({
198
203
  item: true,
199
204
  xs: 3,
200
205
  md: 2,
201
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
206
+ children: [isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
202
207
  display: "flex",
203
208
  justifyContent: "space-between",
204
209
  alignItems: "center",
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
7
+ var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _material = require("@mui/material");
10
10
  var _AssignmentCard = _interopRequireDefault(require("../AssignmentCard/AssignmentCard"));
@@ -13,8 +13,6 @@ var _teacherCreate = _interopRequireDefault(require("../../img/teacher-create-2.
13
13
  var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- 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); }
17
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
16
  const AssignmentCardsList = ({
19
17
  t = text => text,
20
18
  assignments = [],
@@ -27,22 +25,7 @@ const AssignmentCardsList = ({
27
25
  handleEditAssignment,
28
26
  refreshAssignments
29
27
  }) => {
30
- const [expandedAssignmentId, setExpandedAssignmentId] = (0, _react.useState)(null);
31
- (0, _react.useEffect)(() => {
32
- const storedId = localStorage.getItem("expandedAssignmentId");
33
- if (storedId) {
34
- setExpandedAssignmentId(JSON.parse(storedId));
35
- }
36
- }, []);
37
- (0, _react.useEffect)(() => {
38
- if (expandedAssignmentId) {
39
- localStorage.setItem("expandedAssignmentId", JSON.stringify(expandedAssignmentId));
40
- } else {
41
- localStorage.removeItem("expandedAssignmentId");
42
- }
43
- }, [expandedAssignmentId]);
44
28
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
45
- mt: 3,
46
29
  mb: 1,
47
30
  children: assignments.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
48
31
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
@@ -64,14 +47,14 @@ const AssignmentCardsList = ({
64
47
  sx: {
65
48
  textAlign: "center",
66
49
  mt: 2,
67
- width: '70%'
50
+ width: "70%"
68
51
  },
69
52
  children: t("no_assignments_description")
70
53
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
71
54
  sx: {
72
55
  textAlign: "center",
73
56
  mt: 2,
74
- width: '70%'
57
+ width: "70%"
75
58
  },
76
59
  children: t("assignments_description")
77
60
  }), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
@@ -122,7 +105,11 @@ const AssignmentCardsList = ({
122
105
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Refresh.default, {})
123
106
  })
124
107
  })]
125
- }), assignments.map(assignment => /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCard.default, {
108
+ }), assignments.filter(assignment => {
109
+ if (isCreator) return true;
110
+ if (!assignment.scheduleDate) return true;
111
+ return new Date(assignment.scheduleDate) <= new Date();
112
+ }).map(assignment => /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCard.default, {
126
113
  assignment: assignment,
127
114
  t: t,
128
115
  isCreator: isCreator,
@@ -130,9 +117,7 @@ const AssignmentCardsList = ({
130
117
  getCourseSections: getCourseSections,
131
118
  getRoleplays: getRoleplays,
132
119
  deleteAssignment: deleteAssignment,
133
- handleEditAssignment: handleEditAssignment,
134
- isExpanded: expandedAssignmentId === assignment.assignmentId,
135
- setExpandedAssignmentId: setExpandedAssignmentId
120
+ handleEditAssignment: handleEditAssignment
136
121
  }, assignment.assignmentId))]
137
122
  })
138
123
  });
@@ -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")
@@ -215,7 +215,8 @@ function App({
215
215
  verificationStatus,
216
216
  gameAward,
217
217
  isCollapsed,
218
- setIsCollapsed
218
+ setIsCollapsed,
219
+ isUserInternal
219
220
  }) {
220
221
  const theme = (0, _styles.useTheme)();
221
222
  const isLgScreen = (0, _useMediaQuery.default)(theme.breakpoints.up("md"));
@@ -407,7 +408,7 @@ function App({
407
408
  "data-cy": "appbar-create-course",
408
409
  children: t("course")
409
410
  })]
410
- }), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
411
+ }), (isUserInternal || process.env.REACT_APP_STAGE === "dev") && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
411
412
  onClick: handleCreateAssignment,
412
413
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
413
414
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Assignment.default, {})
@@ -37,7 +37,7 @@ function TranscriptViewer({
37
37
  const attendee = attendeesData.find(item => item.username === identifier);
38
38
  const userImage = attendee ? attendee.userImage : null;
39
39
  // console.log({ sentence, attendee, userImage, conversation })
40
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
41
41
  "aria-label": "go to time in recording",
42
42
  display: "flex",
43
43
  alignItems: "center",
@@ -49,27 +49,49 @@ function TranscriptViewer({
49
49
  backgroundColor: "#f2f2f2"
50
50
  }
51
51
  },
52
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
53
- display: "flex",
54
- alignItems: "center",
55
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
56
- alt: sentence?.username,
57
- src: userImage,
52
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Grid.default, {
53
+ container: true,
54
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
55
+ item: true,
56
+ xs: 4,
57
+ md: 3,
58
58
  sx: {
59
- width: 24,
60
- height: 24,
61
- marginRight: "8px"
62
- }
63
- }), sentence?.user && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
64
- style: {
65
- fontWeight: "bold",
66
- marginRight: "8px"
59
+ display: "flex",
60
+ flexDirection: "column"
67
61
  },
68
- children: `${sentence.user}:`
62
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
63
+ display: "flex",
64
+ alignItems: "center",
65
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
66
+ alt: sentence?.username,
67
+ src: userImage,
68
+ sx: {
69
+ width: 24,
70
+ height: 24,
71
+ marginRight: "8px"
72
+ }
73
+ }), sentence?.user && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
74
+ style: {
75
+ fontWeight: "bold",
76
+ marginRight: "8px"
77
+ },
78
+ children: `${sentence.user}:`
79
+ })]
80
+ })
81
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
82
+ item: true,
83
+ xs: 8,
84
+ md: 9,
85
+ sx: {
86
+ display: "flex",
87
+ flexDirection: "column",
88
+ alignItems: "left"
89
+ },
90
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
91
+ children: sentence.text
92
+ })
69
93
  })]
70
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
71
- children: sentence.text
72
- })]
94
+ })
73
95
  }, `conversation-${i}`);
74
96
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
75
97
  variant: "body2",
@@ -395,6 +395,7 @@ function Classroom({
395
395
  handleEditAssignment,
396
396
  getCourses,
397
397
  refreshAssignments,
398
+ isUserInternal,
398
399
  ...otherProps
399
400
  }) {
400
401
  const {
@@ -870,12 +871,11 @@ function Classroom({
870
871
  featureFlags: featureFlags
871
872
  })
872
873
  }, `tab-content-progress`)
873
- }, ...(process.env.REACT_APP_STAGE === "dev" ? [{
874
+ }, ...(isUserInternal && process.env.REACT_APP_STAGE === "dev" ? [{
874
875
  label: t("assignments"),
875
876
  disabled: isMember && isSubscriptionExpired,
876
877
  id: "Assignments",
877
878
  TabContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
878
- py: 1,
879
879
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCardsList.default, {
880
880
  t: t,
881
881
  isCreator: isCreator,
@@ -3,5 +3,36 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.botErrorMessage = void 0;
7
- const botErrorMessage = exports.botErrorMessage = "ERR: No default topic 'random' was found!";
6
+ exports.mockConversation = exports.botErrorMessage = void 0;
7
+ const botErrorMessage = exports.botErrorMessage = "ERR: No default topic 'random' was found!";
8
+ const mockConversation = exports.mockConversation = [{
9
+ start_time: "2025-04-10T10:15:00Z",
10
+ end_time: "2025-04-10T10:16:00Z",
11
+ text: "Hey, did you check the assignment yet?",
12
+ user: "seriouslylong Name 12345",
13
+ userId: "u123"
14
+ }, {
15
+ start_time: "2025-04-10T10:16:10Z",
16
+ end_time: "2025-04-10T10:17:00Z",
17
+ text: "Yeah, looks tough. Want to work on it together?",
18
+ user: "Bob",
19
+ userId: "u456"
20
+ }, {
21
+ start_time: "2025-04-10T10:17:05Z",
22
+ end_time: "2025-04-10T10:17:30Z",
23
+ text: "Sure, let's meet at the library around 4? Also I have been thinking recently about something you told me a few weeks ago, would you like to hear my thoughts?",
24
+ user: "seriouslylong Name 12345",
25
+ userId: "u123"
26
+ }, {
27
+ start_time: "2025-04-10T10:18:00Z",
28
+ end_time: "2025-04-10T10:18:30Z",
29
+ text: "Sounds good. I'll bring my notes.",
30
+ user: "Bob",
31
+ userId: "u456"
32
+ }, {
33
+ start_time: "2025-04-10T10:19:00Z",
34
+ end_time: "2025-04-10T10:19:20Z",
35
+ text: "Great, see you then!",
36
+ user: "seriouslylong Name 12345",
37
+ userId: "u123"
38
+ }];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1230",
3
+ "version": "0.1.1231",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",