@nualang/nualang-ui-components 0.1.1317 → 0.1.1319

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.
@@ -512,6 +512,7 @@ function PhrasesEditor(props) {
512
512
  })
513
513
  }), /*#__PURE__*/_jsx(ToggleButton, {
514
514
  value: Modes.SPREADSHEET,
515
+ "data-cy": "spreadsheet-toggle",
515
516
  children: /*#__PURE__*/_jsx(Tooltip, {
516
517
  title: t("spreadsheet_mode"),
517
518
  children: /*#__PURE__*/_jsx(TableChartIcon, {})
@@ -75,6 +75,7 @@ function SpreadsheetEditor(props) {
75
75
  color: "primary",
76
76
  onClick: saveChanges,
77
77
  disabled: errors.length > 0,
78
+ "data-cy": "save-spreadsheet-changes",
78
79
  children: t("save_changes")
79
80
  })
80
81
  })]
@@ -1,6 +1,7 @@
1
1
  import { useState, useEffect, Fragment } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { withStyles } from "tss-react/mui";
4
+ import { useNavigate, useLocation } from "react-router-dom";
4
5
  import { Typography, Box, List, Dialog, DialogContent, Card, CardActionArea, Button, Select, FormControl, InputLabel, IconButton, Tooltip, CircularProgress, Divider, MenuItem } from "@mui/material";
5
6
  import { red, orange, green, grey } from "@mui/material/colors";
6
7
  import Styles from "../../utils/Styles";
@@ -11,6 +12,7 @@ import EditIcon from "@mui/icons-material/Edit";
11
12
  import ArchiveIcon from "@mui/icons-material/Archive";
12
13
  import dayjs from "dayjs";
13
14
  import GroupFeedbackDialog from "../../Dialogs/GroupedFeedbackDialog/GroupedFeedbackDialog";
15
+ import { useUrlQueryParam } from "../../hooks/useUrlQueryParam";
14
16
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
15
17
  const MeetingPromptsList = withStyles(({
16
18
  scheduleListData,
@@ -39,6 +41,8 @@ const MeetingPromptsList = withStyles(({
39
41
  getRecordings,
40
42
  startTimes = {}
41
43
  }) => {
44
+ const navigate = useNavigate();
45
+ const location = useLocation();
42
46
  const [selectedGroup, setSelectedGroup] = useState({});
43
47
  const [isDialogOpen, setDialogOpen] = useState(false);
44
48
  const [meetingCounts, setMeetingCounts] = useState({});
@@ -51,6 +55,20 @@ const MeetingPromptsList = withStyles(({
51
55
  const [isRecordingDialogOpen, setIsRecordingDialogOpen] = useState(false);
52
56
  const [attendeesData, setAttendeesData] = useState([]);
53
57
  const [loading, setLoading] = useState(false);
58
+ const [groupedIdFromUrl, setGroupedIdFromUrl, clearGroupedId] = useUrlQueryParam("groupedId", {
59
+ hash: "Discuss"
60
+ });
61
+ useEffect(() => {
62
+ if (groupedIdFromUrl && scheduleListData.length > 0) {
63
+ const discussion = scheduleListData.find(item => item.groupedId === groupedIdFromUrl);
64
+ if (discussion) {
65
+ setSelectedGroup(discussion);
66
+ setSelectedDiscussion(discussion);
67
+ setGroupedId(discussion.groupedId);
68
+ setDialogOpen(true);
69
+ }
70
+ }
71
+ }, [groupedIdFromUrl, scheduleListData, setSelectedDiscussion]);
54
72
  const calculateMeetingCounts = () => {
55
73
  const counts = {};
56
74
  scheduleListData?.forEach(item => {
@@ -113,6 +131,8 @@ const MeetingPromptsList = withStyles(({
113
131
  };
114
132
  const closeDialog = () => {
115
133
  setDialogOpen(false);
134
+ setSelectedGroup({});
135
+ clearGroupedId();
116
136
  };
117
137
  useEffect(() => {
118
138
  const selectedDiscussionGroup = scheduleListData.filter(item => item.groupedId === groupedId);
@@ -201,6 +221,7 @@ const MeetingPromptsList = withStyles(({
201
221
  setSelectedDiscussion(discussion);
202
222
  setGroupedId(discussion?.groupedId);
203
223
  openDialog();
224
+ setGroupedIdFromUrl(discussion.groupedId);
204
225
  },
205
226
  children: /*#__PURE__*/_jsxs(Box, {
206
227
  sx: {
@@ -236,18 +257,21 @@ const MeetingPromptsList = withStyles(({
236
257
  },
237
258
  children: formatMeetingDueText(discussion?.meetingDate, discussion?.meetingTime, t)
238
259
  }), /*#__PURE__*/_jsx(Tooltip, {
239
- title: t("edit_discussion"),
240
- children: /*#__PURE__*/_jsx(IconButton, {
241
- size: "medium",
242
- onClick: e => {
243
- e.stopPropagation();
244
- setSelectedDiscussion(discussion);
245
- setSelectedGroup(discussion);
246
- setGroupedId(discussion?.groupedId);
247
- setIsEditMeetingDialogOpen(true);
248
- },
249
- children: /*#__PURE__*/_jsx(EditIcon, {
250
- fontSize: "medium"
260
+ title: submittedCount > 0 ? t("cannot_edit_discussion") : t("edit_discussion"),
261
+ children: /*#__PURE__*/_jsx("span", {
262
+ children: /*#__PURE__*/_jsx(IconButton, {
263
+ size: "medium",
264
+ disabled: submittedCount > 0,
265
+ onClick: e => {
266
+ e.stopPropagation();
267
+ setSelectedDiscussion(discussion);
268
+ setSelectedGroup(discussion);
269
+ setGroupedId(discussion?.groupedId);
270
+ setIsEditMeetingDialogOpen(true);
271
+ },
272
+ children: /*#__PURE__*/_jsx(EditIcon, {
273
+ fontSize: "medium"
274
+ })
251
275
  })
252
276
  })
253
277
  }), /*#__PURE__*/_jsx(Tooltip, {
@@ -361,8 +385,7 @@ const MeetingPromptsList = withStyles(({
361
385
  }), sortedScheduleListData?.length > cardsToShow && /*#__PURE__*/_jsx(Button, {
362
386
  variant: "outlined",
363
387
  "aria-label": t("view_more"),
364
- onClick: () => setCardsToShow(cardsToShow + 2) // Load 2 more cards on button click
365
- ,
388
+ onClick: () => setCardsToShow(cardsToShow + 2),
366
389
  children: t("view_more")
367
390
  })]
368
391
  }), /*#__PURE__*/_jsx(ConfirmDeleteDiscussion, {
@@ -1,4 +1,4 @@
1
- import { useState, Fragment } from "react";
1
+ import { useState, useEffect, Fragment } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { withStyles } from "tss-react/mui";
4
4
  import { Typography, Box, Button } from "@mui/material";
@@ -7,6 +7,7 @@ import RecordingDialog from "../../Dialogs/RecordingDialog/RecordingDialog";
7
7
  import FeedbackDialog from "../../Dialogs/FeedbackInfoDialog/FeedbackInfoDialog";
8
8
  import RecordingCard from "../../Cards/RecordingCard/RecordingCard";
9
9
  import LoadingCard from "../../Cards/LoadingCard/LoadingCard";
10
+ import { useUrlQueryParam } from "../../hooks/useUrlQueryParam";
10
11
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
12
  const RecordingListCards = withStyles(({
12
13
  classes,
@@ -31,6 +32,18 @@ const RecordingListCards = withStyles(({
31
32
  const [open, setOpen] = useState(false);
32
33
  const [feedbackOpen, setFeedbackOpen] = useState(false);
33
34
  const [cardsToShow, setCardsToShow] = useState(3);
35
+ const [recordingIdFromUrl, setRecordingIdFromUrl, clearRecordingIdFromUrl] = useUrlQueryParam("meetingId", {
36
+ hash: 'Discuss'
37
+ });
38
+ useEffect(() => {
39
+ if (recordingIdFromUrl && recordingsTableData.length > 0) {
40
+ const recording = recordingsTableData.find(rec => (rec.meetingId || rec.meetingID)?.toString() === recordingIdFromUrl.toString());
41
+ if (recording) {
42
+ setSelectedRecording(recording);
43
+ setOpen(true);
44
+ }
45
+ }
46
+ }, [recordingIdFromUrl, recordingsTableData, setSelectedRecording]);
34
47
  const attendeeUsernames = [];
35
48
  userData.forEach(user => {
36
49
  [selectedRecording?.attendees].flat().forEach(attendee => {
@@ -50,6 +63,7 @@ const RecordingListCards = withStyles(({
50
63
  const handleJoin = recording => {
51
64
  setSelectedRecording(recording);
52
65
  setOpen(true);
66
+ setRecordingIdFromUrl(recording.meetingId);
53
67
  };
54
68
  const handleFeedbackJoin = recording => {
55
69
  setSelectedRecording(recording);
@@ -58,6 +72,7 @@ const RecordingListCards = withStyles(({
58
72
  const handleClose = () => {
59
73
  resetVideoState();
60
74
  setOpen(false);
75
+ clearRecordingIdFromUrl();
61
76
  };
62
77
  return /*#__PURE__*/_jsxs(Fragment, {
63
78
  children: [/*#__PURE__*/_jsx(Box, {
@@ -122,25 +137,21 @@ const RecordingListCards = withStyles(({
122
137
  })), recordingsTableData?.length > cardsToShow && /*#__PURE__*/_jsx(Button, {
123
138
  variant: "outlined",
124
139
  "aria-label": t("view_more"),
125
- onClick: () => setCardsToShow(cardsToShow + 2) // Load 2 more cards on button click
126
- ,
140
+ onClick: () => setCardsToShow(cardsToShow + 2),
127
141
  children: t("view_more")
128
142
  })]
129
- }) : /*#__PURE__*/_jsx(_Fragment, {
130
- children: /*#__PURE__*/_jsx(Box, {
131
- sx: {
132
- display: "flex",
133
- alignItems: "center",
134
- justifyContent: "center",
135
- height: "15vh",
136
- // You can adjust the height as needed
137
- textAlign: "center" // Center-align text
138
- },
139
- children: /*#__PURE__*/_jsx(Typography, {
140
- component: "h5",
141
- variant: "h5",
142
- children: t("no_recordings_found")
143
- })
143
+ }) : /*#__PURE__*/_jsx(Box, {
144
+ sx: {
145
+ display: "flex",
146
+ alignItems: "center",
147
+ justifyContent: "center",
148
+ height: "15vh",
149
+ textAlign: "center"
150
+ },
151
+ children: /*#__PURE__*/_jsx(Typography, {
152
+ component: "h5",
153
+ variant: "h5",
154
+ children: t("no_recordings_found")
144
155
  })
145
156
  })]
146
157
  });
@@ -0,0 +1,27 @@
1
+ import { useCallback } from "react";
2
+ import { useLocation, useNavigate } from "react-router-dom";
3
+ export function useUrlQueryParam(name, {
4
+ hash
5
+ }) {
6
+ const location = useLocation();
7
+ const navigate = useNavigate();
8
+ const params = new URLSearchParams(location.search);
9
+ const value = params.get(name);
10
+ const setValue = useCallback(newValue => {
11
+ const newParams = new URLSearchParams(location.search);
12
+ if (newValue === null || newValue === undefined) {
13
+ newParams.delete(name);
14
+ } else {
15
+ newParams.set(name, newValue);
16
+ }
17
+ const queryString = newParams.toString();
18
+ const hashSuffix = hash ? `#${hash}` : location.hash;
19
+ navigate(`${location.pathname}${queryString ? `?${queryString}` : ""}${hashSuffix || ""}`, {
20
+ replace: true
21
+ });
22
+ }, [hash, location.pathname, location.search, location.hash, name, navigate]);
23
+ const clear = useCallback(() => {
24
+ setValue(null);
25
+ }, [setValue]);
26
+ return [value, setValue, clear];
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1317",
3
+ "version": "0.1.1319",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -77,7 +77,7 @@
77
77
  "react-qrcode-logo": "^3.0.0",
78
78
  "react-refresh": "^0.17.0",
79
79
  "react-simplemde-editor": "5.2.0",
80
- "react-spreadsheet-grid": "^2.0.0",
80
+ "react-spreadsheet-grid": "^1.4.3",
81
81
  "react-swipeable-views": "^0.14.0",
82
82
  "rehype-raw": "^6.1.0",
83
83
  "socket.io-client": "^4.7.1",