@nualang/nualang-ui-components 0.1.1217 → 0.1.1218
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.
|
@@ -12,6 +12,7 @@ var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess
|
|
|
12
12
|
var _material = require("@mui/material");
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _AssignmentExerciseSelector = _interopRequireDefault(require("../../Misc/AssignmentExerciseSelector/AssignmentExerciseSelector"));
|
|
15
|
+
var _useConfirm = _interopRequireDefault(require("../../hooks/useConfirm"));
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
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); }
|
|
@@ -23,10 +24,11 @@ function Assignment({
|
|
|
23
24
|
username,
|
|
24
25
|
getCourseSections,
|
|
25
26
|
getRoleplays,
|
|
26
|
-
isCreator
|
|
27
|
+
isCreator,
|
|
28
|
+
deleteAssignment
|
|
27
29
|
}) {
|
|
28
|
-
t = text => text;
|
|
29
30
|
const [expanded, setExpanded] = (0, _react.useState)(false);
|
|
31
|
+
const [confirm] = (0, _useConfirm.default)(t);
|
|
30
32
|
const calculateDaysUntilDue = dueDate => {
|
|
31
33
|
const now = new Date();
|
|
32
34
|
const due = new Date(dueDate);
|
|
@@ -46,6 +48,12 @@ function Assignment({
|
|
|
46
48
|
event.stopPropagation();
|
|
47
49
|
setExpanded(prev => !prev);
|
|
48
50
|
};
|
|
51
|
+
const handleDeleteAssignment = async (classroomId, assignmentId) => {
|
|
52
|
+
const confirmed = await confirm(t('delete_assignment'), t('delete_assignment_confirmation'));
|
|
53
|
+
if (confirmed) {
|
|
54
|
+
await deleteAssignment(classroomId, assignmentId);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
49
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Card, {
|
|
50
58
|
sx: {
|
|
51
59
|
display: "flex",
|
|
@@ -109,6 +117,9 @@ function Assignment({
|
|
|
109
117
|
children: t("edit")
|
|
110
118
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
111
119
|
color: "primary",
|
|
120
|
+
onClick: () => {
|
|
121
|
+
handleDeleteAssignment(assignment.classroomId, assignment.assignmentId);
|
|
122
|
+
},
|
|
112
123
|
children: t("delete")
|
|
113
124
|
})]
|
|
114
125
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
@@ -156,8 +156,8 @@ function CreateAssignmentScreen({
|
|
|
156
156
|
};
|
|
157
157
|
});
|
|
158
158
|
};
|
|
159
|
-
const handleCreateAssignment = () => {
|
|
160
|
-
createAssignment(assignment);
|
|
159
|
+
const handleCreateAssignment = async () => {
|
|
160
|
+
await createAssignment(assignment);
|
|
161
161
|
handleClose();
|
|
162
162
|
};
|
|
163
163
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
@@ -18,7 +18,8 @@ const AssignmentCardsList = ({
|
|
|
18
18
|
assignments = [],
|
|
19
19
|
isCreator,
|
|
20
20
|
onRefresh,
|
|
21
|
-
handleCreateAssignment
|
|
21
|
+
handleCreateAssignment,
|
|
22
|
+
deleteAssignment
|
|
22
23
|
}) => {
|
|
23
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
24
25
|
mt: 3,
|
|
@@ -104,7 +105,8 @@ const AssignmentCardsList = ({
|
|
|
104
105
|
}), assignments.map(assignment => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Assignment.default, {
|
|
105
106
|
assignment: assignment,
|
|
106
107
|
t: t,
|
|
107
|
-
isCreator: isCreator
|
|
108
|
+
isCreator: isCreator,
|
|
109
|
+
deleteAssignment: deleteAssignment
|
|
108
110
|
}, assignment.id))]
|
|
109
111
|
})
|
|
110
112
|
});
|
|
@@ -390,6 +390,7 @@ function Classroom({
|
|
|
390
390
|
featureFlags,
|
|
391
391
|
assignments,
|
|
392
392
|
handleCreateAssignment,
|
|
393
|
+
deleteAssignment,
|
|
393
394
|
...otherProps
|
|
394
395
|
}) {
|
|
395
396
|
const {
|
|
@@ -865,7 +866,8 @@ function Classroom({
|
|
|
865
866
|
memberId: !isCreator && username,
|
|
866
867
|
username: username,
|
|
867
868
|
getCourseSections: getCourseSections,
|
|
868
|
-
handleCreateAssignment: handleCreateAssignment
|
|
869
|
+
handleCreateAssignment: handleCreateAssignment,
|
|
870
|
+
deleteAssignment: deleteAssignment
|
|
869
871
|
})
|
|
870
872
|
}, `tab-content-assignments`)
|
|
871
873
|
}] : []), ...(isVideoChatEnabled && isNualangLiveEnabled && (isMember && isVideoChatEnabledInSettings || isCreator) ? [{
|