@nualang/nualang-ui-components 0.1.1305 → 0.1.1306
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.
- package/dist/Cards/FeedbackCard/FeedbackCard.js +365 -0
- package/dist/Cards/RecordingCard/RecordingCard.js +161 -120
- package/dist/Cards/ScheduleCard/ScheduleCard.js +97 -57
- package/dist/Dialogs/GenerateDiscussion/GenerateDiscussion.js +171 -0
- package/dist/Dialogs/GroupedFeedbackDialog/GroupedFeedbackDialog.js +273 -0
- package/dist/Dialogs/RecordingDialog/RecordingDialog.js +61 -43
- package/dist/Forms/CreateMeetingMultiStepForm/CreateMeetingMultiStepForm.js +15 -3
- package/dist/Forms/CreateMeetingMultiStepForm/MeetingForm.js +144 -113
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +7 -1
- package/dist/Tables/MeetingPrompstList/MeetingPromptsList.js +23 -31
- package/dist/Tables/Progress/ProgressTable.js +22 -14
- package/dist/Tables/ScheduleListCards/ScheduleListCards.js +2 -86
- package/dist/img/NualaHeadphonesBackground.svg +39 -0
- package/dist/img/aaronAvatar.png +0 -0
- package/dist/img/connorAvatar.png +0 -0
- package/dist/img/jamieAvatar.png +0 -0
- package/dist/img/stephenAvatar.png +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from "react";
|
|
2
|
+
import { Card, CardContent, CardActions, Typography, Avatar, Box, Button, TextField, Chip, Grid } from "@mui/material";
|
|
3
|
+
import { grey, green } from "@mui/material/colors";
|
|
4
|
+
import AutoFixHighIcon from "@mui/icons-material/AutoFixHigh";
|
|
5
|
+
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
|
|
6
|
+
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
|
|
7
|
+
import { Formik } from "formik";
|
|
8
|
+
import * as Yup from "yup";
|
|
9
|
+
import RecordingDialog from "../../Dialogs/RecordingDialog/RecordingDialog";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
export default function FeedbackCard({
|
|
12
|
+
t = x => x,
|
|
13
|
+
discussionData = {},
|
|
14
|
+
userData = [],
|
|
15
|
+
hasSubmission = false,
|
|
16
|
+
aiGrade = {},
|
|
17
|
+
onGenerateFeedback = () => {},
|
|
18
|
+
onSubmitFeedback = () => {},
|
|
19
|
+
setSelectedRecording = () => {},
|
|
20
|
+
s3Url = "",
|
|
21
|
+
conversation = {},
|
|
22
|
+
existingFeedback = {}
|
|
23
|
+
}) {
|
|
24
|
+
const [isRecordingDialogOpen, setIsRecordingDialogOpen] = useState(false);
|
|
25
|
+
const [hasBeenEdited, setHasBeenEdited] = useState(false);
|
|
26
|
+
const [isSubmitted, setIsSubmitted] = useState(false);
|
|
27
|
+
const [aiJustGenerated, setAiJustGenerated] = useState(false);
|
|
28
|
+
const formikRef = useRef(null);
|
|
29
|
+
const initialValuesRef = useRef(null);
|
|
30
|
+
const selectedMembers = userData.filter(u => [discussionData?.meetingMembers || discussionData?.userIds].flat().includes(u?.memberId));
|
|
31
|
+
const joinedMembers = discussionData?.joinedMembers || [];
|
|
32
|
+
let attendedMembers = [];
|
|
33
|
+
let notAttendedMembers = [];
|
|
34
|
+
if (hasSubmission) {
|
|
35
|
+
attendedMembers = selectedMembers.filter(m => joinedMembers.includes(m?.memberId));
|
|
36
|
+
notAttendedMembers = selectedMembers.filter(m => !joinedMembers.includes(m?.memberId));
|
|
37
|
+
}
|
|
38
|
+
const hasFeedbackSubmitted = hasSubmission && attendedMembers.every(member => {
|
|
39
|
+
const feedback = existingFeedback[member.memberId];
|
|
40
|
+
return feedback && feedback.feedbackText && feedback.feedbackText.trim() !== "";
|
|
41
|
+
});
|
|
42
|
+
const getInitialValues = () => {
|
|
43
|
+
const feedbackData = {};
|
|
44
|
+
if (hasSubmission) {
|
|
45
|
+
attendedMembers.forEach(student => {
|
|
46
|
+
const existingStudentFeedback = existingFeedback[student.memberId];
|
|
47
|
+
feedbackData[student.memberId] = {
|
|
48
|
+
feedbackText: existingStudentFeedback?.feedbackText || ""
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
notAttendedMembers.forEach(student => {
|
|
52
|
+
feedbackData[student.memberId] = {
|
|
53
|
+
feedbackText: existingFeedback[student.memberId]?.feedbackText || t("not_present")
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
selectedMembers.forEach(student => {
|
|
58
|
+
feedbackData[student.memberId] = {
|
|
59
|
+
feedbackText: existingFeedback[student.memberId]?.feedbackText || ""
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
feedbackData
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const attendeesInThisDiscussion = userData.filter(user => [discussionData?.meetingMembers || discussionData?.userIds].flat().includes(user?.memberId));
|
|
68
|
+
const handleOpenRecordingDialog = () => {
|
|
69
|
+
if (hasSubmission) {
|
|
70
|
+
setSelectedRecording({
|
|
71
|
+
meetingId: discussionData?.meetingId,
|
|
72
|
+
extMeetingId: discussionData?.extMeetingId,
|
|
73
|
+
creator: discussionData?.creator || discussionData?.userId,
|
|
74
|
+
meetingCreator: discussionData?.meetingCreator
|
|
75
|
+
});
|
|
76
|
+
setIsRecordingDialogOpen(true);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const initialVals = getInitialValues();
|
|
81
|
+
const previous = initialValuesRef.current;
|
|
82
|
+
const hasChanged = JSON.stringify(previous) !== JSON.stringify(initialVals);
|
|
83
|
+
if (hasChanged) {
|
|
84
|
+
initialValuesRef.current = initialVals;
|
|
85
|
+
setIsSubmitted(false);
|
|
86
|
+
}
|
|
87
|
+
}, [existingFeedback, hasSubmission, selectedMembers, attendedMembers, notAttendedMembers, t]);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const formik = formikRef.current;
|
|
90
|
+
if (!formik) return;
|
|
91
|
+
if (!hasSubmission || !aiGrade || Object.keys(aiGrade).length === 0) return;
|
|
92
|
+
if (!aiJustGenerated) return;
|
|
93
|
+
userData.forEach(student => {
|
|
94
|
+
const keyVariants = [student.username, `${student.username}Student`, student.username?.replace(/\s+/g, "")];
|
|
95
|
+
const aiData = keyVariants.map(k => aiGrade?.[k]).find(v => v && typeof v === "object") || null;
|
|
96
|
+
if (aiData?.Feedback) {
|
|
97
|
+
formik.setFieldValue(`feedbackData.${student.memberId}.feedbackText`, aiData.Feedback);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
setHasBeenEdited(true);
|
|
101
|
+
setIsSubmitted(false);
|
|
102
|
+
setAiJustGenerated(false);
|
|
103
|
+
}, [aiGrade, hasSubmission, userData, aiJustGenerated]);
|
|
104
|
+
const handleGenerateAI = async () => {
|
|
105
|
+
setAiJustGenerated(true);
|
|
106
|
+
await onGenerateFeedback(discussionData);
|
|
107
|
+
};
|
|
108
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
109
|
+
children: [/*#__PURE__*/_jsx(Formik, {
|
|
110
|
+
innerRef: formikRef,
|
|
111
|
+
initialValues: getInitialValues(),
|
|
112
|
+
validationSchema: getFeedbackValidationSchema(attendedMembers.map(m => m.memberId)),
|
|
113
|
+
onSubmit: async (values, {
|
|
114
|
+
setSubmitting
|
|
115
|
+
}) => {
|
|
116
|
+
setSubmitting(true);
|
|
117
|
+
try {
|
|
118
|
+
const allStudents = selectedMembers.map(m => m.memberId);
|
|
119
|
+
const feedbackDataWithAbsent = {
|
|
120
|
+
...values.feedbackData
|
|
121
|
+
};
|
|
122
|
+
notAttendedMembers.forEach(student => {
|
|
123
|
+
feedbackDataWithAbsent[student.memberId] = {
|
|
124
|
+
feedbackText: t("not_present")
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
await onSubmitFeedback({
|
|
128
|
+
feedbackData: feedbackDataWithAbsent,
|
|
129
|
+
selectedAttendee: allStudents,
|
|
130
|
+
discussionData
|
|
131
|
+
});
|
|
132
|
+
initialValuesRef.current = JSON.parse(JSON.stringify(values));
|
|
133
|
+
setHasBeenEdited(false);
|
|
134
|
+
setIsSubmitted(true);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
console.error("Error submitting feedback:", error);
|
|
137
|
+
} finally {
|
|
138
|
+
setSubmitting(false);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
enableReinitialize: false,
|
|
142
|
+
children: ({
|
|
143
|
+
values,
|
|
144
|
+
handleSubmit,
|
|
145
|
+
setFieldValue,
|
|
146
|
+
isSubmitting
|
|
147
|
+
}) => {
|
|
148
|
+
const isFormValid = () => {
|
|
149
|
+
if (!hasSubmission) return false;
|
|
150
|
+
return attendedMembers.every(member => {
|
|
151
|
+
const feedback = values.feedbackData[member.memberId];
|
|
152
|
+
return feedback?.feedbackText && feedback.feedbackText.trim() !== "";
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
const hasChanges = () => {
|
|
156
|
+
if (!initialValuesRef.current) return false;
|
|
157
|
+
return attendedMembers.some(member => {
|
|
158
|
+
const current = values.feedbackData[member.memberId]?.feedbackText || "";
|
|
159
|
+
const initial = initialValuesRef.current.feedbackData[member.memberId]?.feedbackText || "";
|
|
160
|
+
return current !== initial;
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
const canSubmit = hasSubmission && !isSubmitting && isFormValid() && (hasChanges() || hasBeenEdited) && !isSubmitted;
|
|
164
|
+
return /*#__PURE__*/_jsx("form", {
|
|
165
|
+
onSubmit: handleSubmit,
|
|
166
|
+
children: /*#__PURE__*/_jsxs(Card, {
|
|
167
|
+
sx: {
|
|
168
|
+
mb: 3,
|
|
169
|
+
borderRadius: 3,
|
|
170
|
+
boxShadow: 3,
|
|
171
|
+
overflow: "hidden"
|
|
172
|
+
},
|
|
173
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
174
|
+
sx: {
|
|
175
|
+
px: 3,
|
|
176
|
+
pt: 2,
|
|
177
|
+
pb: 1,
|
|
178
|
+
fontWeight: 600,
|
|
179
|
+
color: "text.secondary"
|
|
180
|
+
},
|
|
181
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
|
182
|
+
container: true,
|
|
183
|
+
alignItems: "center",
|
|
184
|
+
spacing: 3,
|
|
185
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
186
|
+
size: {
|
|
187
|
+
xs: 12,
|
|
188
|
+
md: 2.5
|
|
189
|
+
},
|
|
190
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
191
|
+
variant: "subtitle2",
|
|
192
|
+
children: t("student")
|
|
193
|
+
})
|
|
194
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
195
|
+
size: {
|
|
196
|
+
xs: 12,
|
|
197
|
+
md: 9.5
|
|
198
|
+
},
|
|
199
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
200
|
+
variant: "subtitle2",
|
|
201
|
+
children: t("feedback")
|
|
202
|
+
})
|
|
203
|
+
})]
|
|
204
|
+
})
|
|
205
|
+
}), /*#__PURE__*/_jsx(CardContent, {
|
|
206
|
+
sx: {
|
|
207
|
+
px: 3,
|
|
208
|
+
pt: 1
|
|
209
|
+
},
|
|
210
|
+
children: [...selectedMembers].sort((a, b) => {
|
|
211
|
+
const aJoined = joinedMembers.includes(a.memberId);
|
|
212
|
+
const bJoined = joinedMembers.includes(b.memberId);
|
|
213
|
+
return aJoined === bJoined ? 0 : aJoined ? -1 : 1;
|
|
214
|
+
}).map(student => {
|
|
215
|
+
const isAbsent = hasSubmission && !joinedMembers.includes(student.memberId);
|
|
216
|
+
const disabled = !hasSubmission || isAbsent;
|
|
217
|
+
const studentFeedback = values.feedbackData[student.memberId] || {};
|
|
218
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
219
|
+
sx: {
|
|
220
|
+
py: 2
|
|
221
|
+
},
|
|
222
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
|
223
|
+
container: true,
|
|
224
|
+
alignItems: "flex-start",
|
|
225
|
+
spacing: 3,
|
|
226
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
227
|
+
size: {
|
|
228
|
+
xs: 12,
|
|
229
|
+
md: 2.5
|
|
230
|
+
},
|
|
231
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
232
|
+
display: "flex",
|
|
233
|
+
alignItems: "center",
|
|
234
|
+
gap: 2,
|
|
235
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
236
|
+
alt: student.username,
|
|
237
|
+
src: student.userImage,
|
|
238
|
+
sx: {
|
|
239
|
+
width: 48,
|
|
240
|
+
height: 48,
|
|
241
|
+
filter: isAbsent ? "grayscale(100%)" : "none"
|
|
242
|
+
}
|
|
243
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
244
|
+
fontWeight: 600,
|
|
245
|
+
sx: {
|
|
246
|
+
color: isAbsent ? grey[500] : "text.primary"
|
|
247
|
+
},
|
|
248
|
+
children: student.username
|
|
249
|
+
})]
|
|
250
|
+
})
|
|
251
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
252
|
+
size: {
|
|
253
|
+
xs: 12,
|
|
254
|
+
md: 9.5
|
|
255
|
+
},
|
|
256
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
257
|
+
variant: "outlined",
|
|
258
|
+
fullWidth: true,
|
|
259
|
+
multiline: true,
|
|
260
|
+
disabled: disabled,
|
|
261
|
+
value: studentFeedback.feedbackText || "",
|
|
262
|
+
onChange: e => {
|
|
263
|
+
setFieldValue(`feedbackData.${student.memberId}.feedbackText`, e.target.value);
|
|
264
|
+
setHasBeenEdited(true);
|
|
265
|
+
setIsSubmitted(false);
|
|
266
|
+
},
|
|
267
|
+
placeholder: t("Write your feedback here")
|
|
268
|
+
})
|
|
269
|
+
})]
|
|
270
|
+
})
|
|
271
|
+
}, student.memberId);
|
|
272
|
+
})
|
|
273
|
+
}), /*#__PURE__*/_jsxs(CardActions, {
|
|
274
|
+
sx: {
|
|
275
|
+
px: 3,
|
|
276
|
+
py: 2,
|
|
277
|
+
justifyContent: "space-between",
|
|
278
|
+
alignItems: "center",
|
|
279
|
+
flexWrap: "wrap",
|
|
280
|
+
gap: 1.5
|
|
281
|
+
},
|
|
282
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
283
|
+
sx: {
|
|
284
|
+
display: "flex",
|
|
285
|
+
gap: 1.5
|
|
286
|
+
},
|
|
287
|
+
children: [!hasSubmission && /*#__PURE__*/_jsx(Chip, {
|
|
288
|
+
label: t("group_not_submitted"),
|
|
289
|
+
color: "warning",
|
|
290
|
+
variant: "filled",
|
|
291
|
+
icon: /*#__PURE__*/_jsx(ErrorOutlineIcon, {}),
|
|
292
|
+
sx: {
|
|
293
|
+
fontWeight: 500,
|
|
294
|
+
borderRadius: "20px"
|
|
295
|
+
}
|
|
296
|
+
}), hasFeedbackSubmitted && /*#__PURE__*/_jsx(Chip, {
|
|
297
|
+
label: t("feedback_submitted"),
|
|
298
|
+
color: "success",
|
|
299
|
+
variant: "filled",
|
|
300
|
+
icon: /*#__PURE__*/_jsx(CheckCircleIcon, {}),
|
|
301
|
+
sx: {
|
|
302
|
+
fontWeight: 500,
|
|
303
|
+
borderRadius: "20px",
|
|
304
|
+
bgcolor: green[600]
|
|
305
|
+
}
|
|
306
|
+
})]
|
|
307
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
308
|
+
sx: {
|
|
309
|
+
display: "flex",
|
|
310
|
+
gap: 1.5,
|
|
311
|
+
ml: "auto"
|
|
312
|
+
},
|
|
313
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
314
|
+
variant: "outlined",
|
|
315
|
+
disabled: !hasSubmission,
|
|
316
|
+
onClick: handleOpenRecordingDialog,
|
|
317
|
+
children: t("view_recording")
|
|
318
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
319
|
+
variant: "contained",
|
|
320
|
+
color: "secondary",
|
|
321
|
+
disabled: !hasSubmission,
|
|
322
|
+
onClick: handleGenerateAI,
|
|
323
|
+
endIcon: /*#__PURE__*/_jsx(AutoFixHighIcon, {}),
|
|
324
|
+
children: t("generate_feedback")
|
|
325
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
326
|
+
type: "submit",
|
|
327
|
+
variant: "contained",
|
|
328
|
+
disabled: !canSubmit,
|
|
329
|
+
children: isSubmitting ? t("submitting") : t("submit_feedback")
|
|
330
|
+
})]
|
|
331
|
+
})]
|
|
332
|
+
})]
|
|
333
|
+
})
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}), /*#__PURE__*/_jsx(RecordingDialog, {
|
|
337
|
+
t: t,
|
|
338
|
+
open: isRecordingDialogOpen,
|
|
339
|
+
handleClose: () => setIsRecordingDialogOpen(false),
|
|
340
|
+
meetingID: discussionData?.meetingID || discussionData?.meetingId,
|
|
341
|
+
meetingPrompt: discussionData?.meetingPrompt,
|
|
342
|
+
meetingTopic: discussionData?.meetingTopic,
|
|
343
|
+
isTeacher: true,
|
|
344
|
+
attendeesData: attendeesInThisDiscussion,
|
|
345
|
+
conversation: conversation,
|
|
346
|
+
s3Url: s3Url,
|
|
347
|
+
playerRef: {
|
|
348
|
+
current: null
|
|
349
|
+
},
|
|
350
|
+
aiGrade: aiGrade,
|
|
351
|
+
hasBadLanguage: discussionData?.hasBadLanguage || false
|
|
352
|
+
})]
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
const getFeedbackValidationSchema = attendedMemberIds => {
|
|
356
|
+
return Yup.object().shape({
|
|
357
|
+
feedbackData: Yup.object().test("all-attended-filled", "All attended students must have feedback", function (value) {
|
|
358
|
+
if (!attendedMemberIds || attendedMemberIds.length === 0) return true;
|
|
359
|
+
return attendedMemberIds.every(memberId => {
|
|
360
|
+
const feedback = value?.[memberId];
|
|
361
|
+
return feedback?.feedbackText && feedback.feedbackText.trim() !== "";
|
|
362
|
+
});
|
|
363
|
+
})
|
|
364
|
+
});
|
|
365
|
+
};
|
|
@@ -1,148 +1,190 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from "react";
|
|
2
2
|
import Typography from "@mui/material/Typography";
|
|
3
3
|
import Avatar from "@mui/material/Avatar";
|
|
4
|
-
import
|
|
4
|
+
import AvatarGroup from "@mui/material/AvatarGroup";
|
|
5
|
+
import Chip from "@mui/material/Chip";
|
|
5
6
|
import Box from "@mui/material/Box";
|
|
6
|
-
import { Card,
|
|
7
|
+
import { Card, CardActionArea, Divider, Button, Tooltip } from "@mui/material";
|
|
7
8
|
import PropTypes from "prop-types";
|
|
8
|
-
import
|
|
9
|
+
import dayjs from "dayjs";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
11
|
export default function RecordingCard({
|
|
10
12
|
isTeacher = false,
|
|
11
13
|
recordingsListData = {},
|
|
12
14
|
handleView = () => {},
|
|
13
|
-
|
|
14
|
-
userData = {},
|
|
15
|
+
userData = [],
|
|
15
16
|
t = x => x
|
|
16
17
|
}) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const date = new Date(isoTimestamp);
|
|
20
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
21
|
-
const day = String(date.getDate()).padStart(2, "0");
|
|
22
|
-
const year = date.getFullYear();
|
|
23
|
-
return `${month}/${day}/${year}`;
|
|
24
|
-
}
|
|
25
|
-
function formatDateTime(isoTimestamp) {
|
|
26
|
-
const date = new Date(isoTimestamp);
|
|
27
|
-
const hours = date.getHours();
|
|
28
|
-
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
29
|
-
const period = hours >= 12 ? "PM" : "AM";
|
|
30
|
-
const formattedHours = (hours % 12 === 0 ? 12 : hours % 12).toString().padStart(2, "0");
|
|
31
|
-
return `${formattedHours}:${minutes} ${period}`;
|
|
32
|
-
}
|
|
18
|
+
const [promptExpanded, setPromptExpanded] = useState(false);
|
|
19
|
+
const selectedMembers = userData.filter(o1 => [recordingsListData?.userIds].flat().some(o2 => o1?.memberId === o2));
|
|
33
20
|
const attendedMembers = selectedMembers.filter(attendee => recordingsListData?.joinedMembers?.includes(attendee?.memberId));
|
|
34
21
|
const notAttendedMembers = selectedMembers.filter(attendee => !recordingsListData?.joinedMembers?.includes(attendee?.memberId));
|
|
22
|
+
const formatMeetingDueText = (timestamp, t) => {
|
|
23
|
+
const meetingDateTime = dayjs(timestamp);
|
|
24
|
+
const now = dayjs();
|
|
25
|
+
const formattedDate = meetingDateTime.format("D MMM YYYY • h:mm A");
|
|
26
|
+
const diffDays = meetingDateTime.startOf("day").diff(now.startOf("day"), "day");
|
|
27
|
+
let dueText = "";
|
|
28
|
+
if (diffDays < 0) dueText = t("past_due");else if (diffDays === 0) dueText = t("due_today");else if (diffDays === 1) dueText = t("due_tomorrow");else dueText = `${t("due_in")} ${diffDays} ${t("days")}`;
|
|
29
|
+
return `${formattedDate} - ${dueText}`;
|
|
30
|
+
};
|
|
31
|
+
const renderExpandableText = (text, expanded, setExpanded, maxChars = 150) => {
|
|
32
|
+
if (!text) return null;
|
|
33
|
+
const isLong = text.length > maxChars;
|
|
34
|
+
const displayedText = expanded || !isLong ? text : text.substring(0, maxChars) + "...";
|
|
35
|
+
return /*#__PURE__*/_jsxs(Typography, {
|
|
36
|
+
variant: "body2",
|
|
37
|
+
color: "text.secondary",
|
|
38
|
+
sx: {
|
|
39
|
+
lineHeight: 1.6,
|
|
40
|
+
whiteSpace: "pre-line",
|
|
41
|
+
mb: 1
|
|
42
|
+
},
|
|
43
|
+
children: [displayedText, " ", isLong && /*#__PURE__*/_jsx(Button, {
|
|
44
|
+
size: "small",
|
|
45
|
+
onClick: e => {
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
setExpanded(!expanded);
|
|
48
|
+
},
|
|
49
|
+
children: expanded ? t("show_less") : t("show_more")
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
35
53
|
return /*#__PURE__*/_jsx(Card, {
|
|
36
54
|
sx: {
|
|
37
55
|
display: "flex",
|
|
38
56
|
marginBottom: 2,
|
|
39
57
|
boxShadow: 3
|
|
40
58
|
},
|
|
41
|
-
children: /*#__PURE__*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
children: /*#__PURE__*/_jsx(CardActionArea, {
|
|
60
|
+
component: "a",
|
|
61
|
+
onClick: handleView,
|
|
62
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
63
|
+
sx: {
|
|
64
|
+
p: 2
|
|
65
|
+
},
|
|
66
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
67
|
+
sx: {
|
|
68
|
+
display: "flex",
|
|
69
|
+
justifyContent: "space-between",
|
|
70
|
+
alignItems: "center"
|
|
71
|
+
},
|
|
72
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
73
|
+
sx: {
|
|
74
|
+
display: "flex",
|
|
75
|
+
alignItems: "center",
|
|
76
|
+
gap: 1
|
|
77
|
+
},
|
|
78
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
79
|
+
variant: "body1",
|
|
80
|
+
fontWeight: 600,
|
|
52
81
|
sx: {
|
|
53
|
-
|
|
54
|
-
alignItems: "center"
|
|
82
|
+
color: "text.primary"
|
|
55
83
|
},
|
|
56
|
-
children:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
children: recordingsListData?.meetingTopic
|
|
85
|
+
}), recordingsListData?.feedbackText && /*#__PURE__*/_jsx(Chip, {
|
|
86
|
+
label: t("submission_graded"),
|
|
87
|
+
color: "success",
|
|
88
|
+
size: "small"
|
|
89
|
+
})]
|
|
90
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
91
|
+
variant: "body2",
|
|
92
|
+
color: "text.secondary",
|
|
93
|
+
sx: {
|
|
94
|
+
ml: 1.5,
|
|
95
|
+
fontWeight: 500
|
|
96
|
+
},
|
|
97
|
+
children: formatMeetingDueText(recordingsListData.timestamp, t)
|
|
98
|
+
})]
|
|
99
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
100
|
+
sx: {
|
|
101
|
+
my: 1.5
|
|
102
|
+
}
|
|
103
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
104
|
+
sx: {
|
|
105
|
+
display: "flex",
|
|
106
|
+
justifyContent: "space-between",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
mb: 1.5
|
|
109
|
+
},
|
|
110
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
111
|
+
sx: {
|
|
112
|
+
display: "flex",
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
gap: 1
|
|
115
|
+
},
|
|
116
|
+
children: [/*#__PURE__*/_jsx(AvatarGroup, {
|
|
117
|
+
max: 4,
|
|
90
118
|
sx: {
|
|
91
|
-
|
|
119
|
+
display: "flex",
|
|
120
|
+
"& .MuiAvatar-root": {
|
|
121
|
+
width: 40,
|
|
122
|
+
height: 40,
|
|
123
|
+
fontSize: "1rem"
|
|
124
|
+
}
|
|
92
125
|
},
|
|
93
|
-
children: /*#__PURE__*/_jsx(
|
|
94
|
-
|
|
95
|
-
children:
|
|
96
|
-
|
|
97
|
-
|
|
126
|
+
children: attendedMembers.map(attendee => /*#__PURE__*/_jsx(Tooltip, {
|
|
127
|
+
title: `${attendee?.username} - Present`,
|
|
128
|
+
children: /*#__PURE__*/_jsx(Avatar, {
|
|
129
|
+
alt: attendee?.username,
|
|
130
|
+
src: attendee?.userImage
|
|
131
|
+
})
|
|
132
|
+
}, attendee?.memberId))
|
|
133
|
+
}), notAttendedMembers.length > 0 && /*#__PURE__*/_jsx(AvatarGroup, {
|
|
134
|
+
max: 4,
|
|
98
135
|
sx: {
|
|
99
|
-
|
|
136
|
+
display: "flex",
|
|
137
|
+
ml: 2,
|
|
138
|
+
"& .MuiAvatar-root": {
|
|
139
|
+
width: 40,
|
|
140
|
+
height: 40,
|
|
141
|
+
fontSize: "1rem",
|
|
142
|
+
filter: "grayscale(100%)"
|
|
143
|
+
}
|
|
100
144
|
},
|
|
101
|
-
children: /*#__PURE__*/_jsx(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
children: recordingsListData.meetingPrompt
|
|
109
|
-
})
|
|
110
|
-
}), /*#__PURE__*/_jsxs(Typography, {
|
|
111
|
-
children: [formatDateToMMDDYYYY(recordingsListData.timestamp), " \u2022", " ", formatDateTime(recordingsListData.timestamp)]
|
|
145
|
+
children: notAttendedMembers.map(attendee => /*#__PURE__*/_jsx(Tooltip, {
|
|
146
|
+
title: `${attendee?.username} - Not Present`,
|
|
147
|
+
children: /*#__PURE__*/_jsx(Avatar, {
|
|
148
|
+
alt: attendee?.username,
|
|
149
|
+
src: attendee?.userImage
|
|
150
|
+
})
|
|
151
|
+
}, attendee?.memberId))
|
|
112
152
|
})]
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
}), /*#__PURE__*/_jsx(Grid, {
|
|
116
|
-
sx: {
|
|
117
|
-
display: "flex",
|
|
118
|
-
justifyContent: "center"
|
|
119
|
-
},
|
|
120
|
-
size: 2,
|
|
121
|
-
children: /*#__PURE__*/_jsx(CardActions, {
|
|
122
|
-
children: !isTeacher && recordingsListData?.gradingOption && /*#__PURE__*/_jsx(Button, {
|
|
153
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
154
|
+
variant: "contained",
|
|
123
155
|
color: "primary",
|
|
124
|
-
onClick:
|
|
125
|
-
|
|
156
|
+
onClick: e => {
|
|
157
|
+
e.stopPropagation();
|
|
158
|
+
handleView();
|
|
159
|
+
},
|
|
160
|
+
sx: {
|
|
161
|
+
borderRadius: 2
|
|
162
|
+
},
|
|
163
|
+
children: t("view_submission")
|
|
164
|
+
})]
|
|
165
|
+
}), renderExpandableText(recordingsListData?.meetingPrompt, promptExpanded, setPromptExpanded), recordingsListData?.feedbackText && /*#__PURE__*/_jsxs(_Fragment, {
|
|
166
|
+
children: [/*#__PURE__*/_jsx(Divider, {
|
|
167
|
+
sx: {
|
|
168
|
+
my: 1.5,
|
|
169
|
+
width: "100%"
|
|
170
|
+
}
|
|
171
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
172
|
+
variant: "subtitle2",
|
|
173
|
+
fontWeight: 600,
|
|
174
|
+
sx: {
|
|
175
|
+
mb: 0.5
|
|
176
|
+
},
|
|
126
177
|
children: t("feedback")
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
children: /*#__PURE__*/_jsx(CardActions, {
|
|
138
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
139
|
-
color: "primary",
|
|
140
|
-
onClick: handleView,
|
|
141
|
-
"aria-label": `View, Recorded Discussion: ${recordingsListData.meetingTopic}`,
|
|
142
|
-
children: t("view")
|
|
143
|
-
})
|
|
144
|
-
})
|
|
145
|
-
})]
|
|
178
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
179
|
+
variant: "body2",
|
|
180
|
+
color: "text.secondary",
|
|
181
|
+
sx: {
|
|
182
|
+
fontStyle: "italic"
|
|
183
|
+
},
|
|
184
|
+
children: recordingsListData.feedbackText
|
|
185
|
+
})]
|
|
186
|
+
})]
|
|
187
|
+
})
|
|
146
188
|
})
|
|
147
189
|
});
|
|
148
190
|
}
|
|
@@ -151,6 +193,5 @@ RecordingCard.propTypes = {
|
|
|
151
193
|
recordingsListData: PropTypes.object,
|
|
152
194
|
userData: PropTypes.object,
|
|
153
195
|
handleView: PropTypes.func,
|
|
154
|
-
t: PropTypes.func
|
|
155
|
-
handleViewFeedback: PropTypes.func
|
|
196
|
+
t: PropTypes.func
|
|
156
197
|
};
|