@nualang/nualang-ui-components 0.1.1200 → 0.1.1201
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/Assignment/Assignment.js +220 -0
- package/dist/Cards/Assignment/package.json +7 -0
- package/dist/Dialogs/ConfirmDeleteDiscussion/ConfirmDeleteDiscussion.js +5 -3
- package/dist/Dialogs/CreateAssignmentScreen/CreateAssignmentScreen.js +303 -0
- package/dist/Dialogs/CreateAssignmentScreen/package.json +7 -0
- package/dist/Lists/AssignmentCardsList/AssignmentCardsList.js +114 -0
- package/dist/Lists/AssignmentCardsList/package.json +7 -0
- package/dist/Lists/CourseSelection/CourseSelection.js +20 -3
- package/dist/Lists/ExerciseSelection/ExerciseSelection.js +56 -3
- package/dist/Misc/AssignmentExerciseSelector/AssignmentExerciseSelector.js +38 -0
- package/dist/Misc/AssignmentExerciseSelector/package.json +7 -0
- package/dist/Navigation/ResponsiveTabs/ResponsiveTabs.js +23 -0
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +27 -3
- package/dist/Tables/MeetingPrompstList/MeetingPromptsList.js +69 -44
- package/dist/Tables/SubmissionsTableCards/SubmissionsTableCards.js +105 -50
- package/package.json +3 -2
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Assignment;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
9
|
+
var _Avatar = _interopRequireDefault(require("@mui/material/Avatar"));
|
|
10
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
11
|
+
var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
|
|
12
|
+
var _material = require("@mui/material");
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _AssignmentExerciseSelector = _interopRequireDefault(require("../../Misc/AssignmentExerciseSelector/AssignmentExerciseSelector"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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); }
|
|
18
|
+
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; }
|
|
19
|
+
function Assignment({
|
|
20
|
+
t,
|
|
21
|
+
assignment,
|
|
22
|
+
handleStartExercise,
|
|
23
|
+
username,
|
|
24
|
+
getCourseSections,
|
|
25
|
+
getRoleplays,
|
|
26
|
+
isCreator
|
|
27
|
+
}) {
|
|
28
|
+
t = text => text;
|
|
29
|
+
const [expanded, setExpanded] = (0, _react.useState)(false);
|
|
30
|
+
const calculateDaysUntilDue = dueDate => {
|
|
31
|
+
const now = new Date();
|
|
32
|
+
const due = new Date(dueDate);
|
|
33
|
+
const diffTime = due - now;
|
|
34
|
+
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
35
|
+
if (diffDays < 0) {
|
|
36
|
+
return t("overdue");
|
|
37
|
+
} else if (diffDays === 0) {
|
|
38
|
+
return t("due_today");
|
|
39
|
+
} else if (diffDays === 1) {
|
|
40
|
+
return t("due_tomorrow");
|
|
41
|
+
} else {
|
|
42
|
+
return `${t("due_in")} ${diffDays} ${t("days")}`;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const handleIconClick = event => {
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
setExpanded(prev => !prev);
|
|
48
|
+
};
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Card, {
|
|
50
|
+
sx: {
|
|
51
|
+
display: "flex",
|
|
52
|
+
marginBottom: 2,
|
|
53
|
+
boxShadow: 3
|
|
54
|
+
},
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.CardContent, {
|
|
56
|
+
sx: {
|
|
57
|
+
flexGrow: 1
|
|
58
|
+
},
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
60
|
+
container: true,
|
|
61
|
+
spacing: 2,
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
64
|
+
item: true,
|
|
65
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
66
|
+
sx: {
|
|
67
|
+
width: 50,
|
|
68
|
+
height: 50
|
|
69
|
+
},
|
|
70
|
+
src: assignment.image
|
|
71
|
+
})
|
|
72
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
73
|
+
item: true,
|
|
74
|
+
xs: true,
|
|
75
|
+
flexDirection: "column",
|
|
76
|
+
display: "flex",
|
|
77
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
78
|
+
variant: "body1",
|
|
79
|
+
component: "div",
|
|
80
|
+
children: assignment.title
|
|
81
|
+
}), !isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
82
|
+
sx: {
|
|
83
|
+
display: "flex",
|
|
84
|
+
alignItems: "center"
|
|
85
|
+
},
|
|
86
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.LinearProgress, {
|
|
87
|
+
variant: "determinate",
|
|
88
|
+
value: assignment.completed / assignment.assigned * 100 //change this to the actual value of student completed
|
|
89
|
+
,
|
|
90
|
+
sx: {
|
|
91
|
+
height: 10,
|
|
92
|
+
borderRadius: 5,
|
|
93
|
+
width: "25%"
|
|
94
|
+
},
|
|
95
|
+
color: "success"
|
|
96
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
97
|
+
variant: "body2",
|
|
98
|
+
sx: {
|
|
99
|
+
color: "text.secondary",
|
|
100
|
+
marginLeft: 1
|
|
101
|
+
},
|
|
102
|
+
children: `${Math.round(assignment.completed / assignment.assigned * 100)}%`
|
|
103
|
+
})]
|
|
104
|
+
})]
|
|
105
|
+
}), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
106
|
+
item: true,
|
|
107
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
108
|
+
color: "primary",
|
|
109
|
+
children: t("edit")
|
|
110
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
111
|
+
color: "primary",
|
|
112
|
+
children: t("delete")
|
|
113
|
+
})]
|
|
114
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
115
|
+
item: true,
|
|
116
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
117
|
+
variant: "button",
|
|
118
|
+
color: "text.secondary",
|
|
119
|
+
children: calculateDaysUntilDue(assignment.dueDate)
|
|
120
|
+
})
|
|
121
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
122
|
+
item: true,
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
124
|
+
onClick: handleIconClick,
|
|
125
|
+
children: expanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})
|
|
126
|
+
})
|
|
127
|
+
})]
|
|
128
|
+
}), expanded && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
129
|
+
mt: 2,
|
|
130
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
131
|
+
sx: {
|
|
132
|
+
marginBottom: 1.5
|
|
133
|
+
}
|
|
134
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
135
|
+
container: true,
|
|
136
|
+
spacing: 2,
|
|
137
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
138
|
+
item: true,
|
|
139
|
+
xs: 12,
|
|
140
|
+
md: 9.5,
|
|
141
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
142
|
+
variant: "body2",
|
|
143
|
+
children: assignment.description
|
|
144
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
145
|
+
mt: 2,
|
|
146
|
+
width: "80%",
|
|
147
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentExerciseSelector.default, {
|
|
148
|
+
t: t,
|
|
149
|
+
assignment: assignment,
|
|
150
|
+
handleStartExercise: handleStartExercise,
|
|
151
|
+
username: username,
|
|
152
|
+
getCourseSections: getCourseSections,
|
|
153
|
+
getRoleplays: getRoleplays,
|
|
154
|
+
isAssignment: true,
|
|
155
|
+
isCreator: isCreator
|
|
156
|
+
})
|
|
157
|
+
})]
|
|
158
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
159
|
+
item: true,
|
|
160
|
+
xs: 3,
|
|
161
|
+
md: 2,
|
|
162
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
163
|
+
display: "flex",
|
|
164
|
+
justifyContent: "space-between",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
sx: {
|
|
167
|
+
textAlign: "center"
|
|
168
|
+
},
|
|
169
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
170
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
171
|
+
variant: "h4",
|
|
172
|
+
children: assignment.completed
|
|
173
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
174
|
+
variant: "body2",
|
|
175
|
+
color: "text.secondary",
|
|
176
|
+
children: t("Completed")
|
|
177
|
+
})]
|
|
178
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
179
|
+
orientation: "vertical",
|
|
180
|
+
flexItem: true,
|
|
181
|
+
sx: {
|
|
182
|
+
width: "2px",
|
|
183
|
+
marginX: 2,
|
|
184
|
+
backgroundColor: "darkgray"
|
|
185
|
+
}
|
|
186
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
187
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
188
|
+
variant: "h4",
|
|
189
|
+
children: assignment.assigned
|
|
190
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
191
|
+
variant: "body2",
|
|
192
|
+
color: "text.secondary",
|
|
193
|
+
children: t("assigned")
|
|
194
|
+
})]
|
|
195
|
+
})]
|
|
196
|
+
}), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
197
|
+
variant: "contained",
|
|
198
|
+
sx: {
|
|
199
|
+
marginTop: 2,
|
|
200
|
+
marginLeft: "15px"
|
|
201
|
+
},
|
|
202
|
+
children: t("view_progress")
|
|
203
|
+
})]
|
|
204
|
+
})]
|
|
205
|
+
})]
|
|
206
|
+
})]
|
|
207
|
+
})
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
Assignment.propTypes = {
|
|
211
|
+
assignment: _propTypes.default.shape({
|
|
212
|
+
image: _propTypes.default.string,
|
|
213
|
+
title: _propTypes.default.string,
|
|
214
|
+
description: _propTypes.default.string,
|
|
215
|
+
dueDate: _propTypes.default.string.isRequired,
|
|
216
|
+
completed: _propTypes.default.number,
|
|
217
|
+
assigned: _propTypes.default.number,
|
|
218
|
+
t: _propTypes.default.func
|
|
219
|
+
}).isRequired
|
|
220
|
+
};
|
|
@@ -12,17 +12,19 @@ function ConfirmDeleteDiscussion({
|
|
|
12
12
|
handleConfirmDeleteDiscussion = () => {},
|
|
13
13
|
handleCloseDeleteDiscussionDialog = () => {},
|
|
14
14
|
t = text => text,
|
|
15
|
-
deleteDiscussionDialogOpen = false
|
|
15
|
+
deleteDiscussionDialogOpen = false,
|
|
16
|
+
archiveTitle,
|
|
17
|
+
archiveDescription
|
|
16
18
|
}) {
|
|
17
19
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
18
20
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
19
21
|
open: deleteDiscussionDialogOpen,
|
|
20
22
|
onClose: handleCloseDeleteDiscussionDialog,
|
|
21
23
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogTitle, {
|
|
22
|
-
children: t(
|
|
24
|
+
children: t(archiveTitle)
|
|
23
25
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
|
|
24
26
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContentText, {
|
|
25
|
-
children: t(
|
|
27
|
+
children: t(archiveDescription)
|
|
26
28
|
})
|
|
27
29
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogActions, {
|
|
28
30
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = CreateAssignmentScreen;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _material = require("@mui/material");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
11
|
+
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
12
|
+
var _AdapterDayjs = require("@mui/x-date-pickers/AdapterDayjs");
|
|
13
|
+
var _LocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
|
|
14
|
+
var _DatePicker = require("@mui/x-date-pickers/DatePicker");
|
|
15
|
+
var _mui = require("tss-react/mui");
|
|
16
|
+
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
17
|
+
var _ArrowDropUp = _interopRequireDefault(require("@mui/icons-material/ArrowDropUp"));
|
|
18
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
const useStyles = (0, _mui.makeStyles)()(theme => ({
|
|
24
|
+
appBar: {
|
|
25
|
+
position: "relative"
|
|
26
|
+
},
|
|
27
|
+
dialogContent: {
|
|
28
|
+
display: "flex",
|
|
29
|
+
gap: theme.spacing(2),
|
|
30
|
+
padding: theme.spacing(3)
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
function Transition(props) {
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Slide, {
|
|
35
|
+
direction: "up",
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function CreateAssignmentScreen({
|
|
40
|
+
t,
|
|
41
|
+
classrooms = [],
|
|
42
|
+
open,
|
|
43
|
+
handleClose
|
|
44
|
+
}) {
|
|
45
|
+
const {
|
|
46
|
+
classes
|
|
47
|
+
} = useStyles();
|
|
48
|
+
const [assignment, setAssignment] = (0, _react.useState)({
|
|
49
|
+
classroom: "",
|
|
50
|
+
students: [],
|
|
51
|
+
title: "",
|
|
52
|
+
description: "",
|
|
53
|
+
assignDate: (0, _dayjs.default)(),
|
|
54
|
+
dueDate: (0, _dayjs.default)().add(1, "day")
|
|
55
|
+
});
|
|
56
|
+
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
|
57
|
+
const handleMenuOpen = event => {
|
|
58
|
+
setAnchorEl(event.currentTarget);
|
|
59
|
+
};
|
|
60
|
+
const handleMenuClose = () => {
|
|
61
|
+
setAnchorEl(null);
|
|
62
|
+
};
|
|
63
|
+
const handleChange = field => event => {
|
|
64
|
+
let value = event?.target?.value ?? event;
|
|
65
|
+
setAssignment(prev => {
|
|
66
|
+
if (field === "students") {
|
|
67
|
+
return {
|
|
68
|
+
...prev,
|
|
69
|
+
students: typeof value === "string" ? value.split(",") : value
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (field === "classroom") {
|
|
73
|
+
return {
|
|
74
|
+
...prev,
|
|
75
|
+
classroom: value,
|
|
76
|
+
students: []
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
...prev,
|
|
81
|
+
[field]: value
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const selectedClassroom = classrooms.find(c => c.id === assignment.classroom);
|
|
86
|
+
const studentsInClassroom = selectedClassroom ? selectedClassroom.students : [];
|
|
87
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
88
|
+
fullScreen: true,
|
|
89
|
+
open: open,
|
|
90
|
+
onClose: handleClose,
|
|
91
|
+
TransitionComponent: Transition,
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AppBar, {
|
|
93
|
+
className: classes.appBar,
|
|
94
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Toolbar, {
|
|
95
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
96
|
+
edge: "start",
|
|
97
|
+
color: "inherit",
|
|
98
|
+
onClick: handleClose,
|
|
99
|
+
"aria-label": "Close",
|
|
100
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {})
|
|
101
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
102
|
+
variant: "h5",
|
|
103
|
+
fontWeight: "bold",
|
|
104
|
+
textAlign: "center",
|
|
105
|
+
mb: 1,
|
|
106
|
+
children: t("create_assignment")
|
|
107
|
+
})]
|
|
108
|
+
})
|
|
109
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
110
|
+
component: "main",
|
|
111
|
+
className: classes.dialogContent,
|
|
112
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Card, {
|
|
113
|
+
sx: {
|
|
114
|
+
display: "flex",
|
|
115
|
+
flexDirection: "column",
|
|
116
|
+
padding: 1,
|
|
117
|
+
boxShadow: 3,
|
|
118
|
+
width: "50%"
|
|
119
|
+
},
|
|
120
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.CardContent, {
|
|
121
|
+
sx: {
|
|
122
|
+
flexGrow: 1,
|
|
123
|
+
display: "flex",
|
|
124
|
+
flexDirection: "column",
|
|
125
|
+
gap: 2
|
|
126
|
+
},
|
|
127
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
128
|
+
fullWidth: true,
|
|
129
|
+
variant: "outlined",
|
|
130
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
131
|
+
id: "classroom-label",
|
|
132
|
+
children: t("select_classroom")
|
|
133
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
|
|
134
|
+
labelId: "classroom-label",
|
|
135
|
+
id: "classroom",
|
|
136
|
+
value: assignment.classroom,
|
|
137
|
+
label: t("select_classroom"),
|
|
138
|
+
onChange: handleChange("classroom"),
|
|
139
|
+
children: classrooms.map(classroom => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
140
|
+
value: classroom.id,
|
|
141
|
+
children: classroom.name
|
|
142
|
+
}, classroom.id))
|
|
143
|
+
})]
|
|
144
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
145
|
+
label: t("assignment_title"),
|
|
146
|
+
fullWidth: true,
|
|
147
|
+
value: assignment.title,
|
|
148
|
+
onChange: handleChange("title")
|
|
149
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
150
|
+
label: t("assignment_description"),
|
|
151
|
+
fullWidth: true,
|
|
152
|
+
multiline: true,
|
|
153
|
+
rows: 3,
|
|
154
|
+
value: assignment.description,
|
|
155
|
+
onChange: handleChange("description")
|
|
156
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
157
|
+
variant: "outlined",
|
|
158
|
+
color: "primary",
|
|
159
|
+
sx: {
|
|
160
|
+
width: "fit-content"
|
|
161
|
+
},
|
|
162
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {}),
|
|
163
|
+
children: t("add_exercise")
|
|
164
|
+
})]
|
|
165
|
+
})
|
|
166
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Card, {
|
|
167
|
+
sx: {
|
|
168
|
+
display: "flex",
|
|
169
|
+
flexDirection: "column",
|
|
170
|
+
padding: 1,
|
|
171
|
+
boxShadow: 3,
|
|
172
|
+
width: "50%"
|
|
173
|
+
},
|
|
174
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.CardContent, {
|
|
175
|
+
sx: {
|
|
176
|
+
flexGrow: 1,
|
|
177
|
+
display: "flex",
|
|
178
|
+
flexDirection: "column",
|
|
179
|
+
gap: 2
|
|
180
|
+
},
|
|
181
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
182
|
+
fullWidth: true,
|
|
183
|
+
disabled: !assignment.classroom,
|
|
184
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
185
|
+
id: "students-label",
|
|
186
|
+
children: t("select_students")
|
|
187
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
|
|
188
|
+
labelId: "students-label",
|
|
189
|
+
id: "students",
|
|
190
|
+
label: t("select_students"),
|
|
191
|
+
multiple: true,
|
|
192
|
+
value: assignment.students,
|
|
193
|
+
onChange: handleChange("students"),
|
|
194
|
+
renderValue: selected => studentsInClassroom.filter(student => selected.includes(student.id)).map(s => s.name).join(", "),
|
|
195
|
+
children: studentsInClassroom.map(student => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
196
|
+
value: student.id,
|
|
197
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
198
|
+
src: student.userImage,
|
|
199
|
+
sx: {
|
|
200
|
+
mr: 2
|
|
201
|
+
}
|
|
202
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
203
|
+
primary: student.name
|
|
204
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
205
|
+
checked: assignment.students.includes(student.id)
|
|
206
|
+
})]
|
|
207
|
+
}, student.id))
|
|
208
|
+
})]
|
|
209
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalizationProvider.LocalizationProvider, {
|
|
210
|
+
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
211
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, {
|
|
212
|
+
label: t("due_date"),
|
|
213
|
+
value: assignment.dueDate,
|
|
214
|
+
onChange: date => setAssignment(prev => ({
|
|
215
|
+
...prev,
|
|
216
|
+
dueDate: date
|
|
217
|
+
}))
|
|
218
|
+
})
|
|
219
|
+
})]
|
|
220
|
+
})
|
|
221
|
+
})]
|
|
222
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
223
|
+
sx: {
|
|
224
|
+
position: "fixed",
|
|
225
|
+
bottom: 0,
|
|
226
|
+
width: "100%",
|
|
227
|
+
backgroundColor: "white",
|
|
228
|
+
boxShadow: "0 -2px 5px rgba(0,0,0,0.1)",
|
|
229
|
+
p: 2,
|
|
230
|
+
textAlign: "center",
|
|
231
|
+
display: "flex",
|
|
232
|
+
justifyContent: "flex-end"
|
|
233
|
+
},
|
|
234
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
235
|
+
color: "primary",
|
|
236
|
+
sx: {
|
|
237
|
+
marginRight: 2
|
|
238
|
+
},
|
|
239
|
+
children: t("cancel")
|
|
240
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonGroup, {
|
|
241
|
+
variant: "contained",
|
|
242
|
+
color: "primary",
|
|
243
|
+
sx: {
|
|
244
|
+
borderRadius: 10
|
|
245
|
+
},
|
|
246
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
247
|
+
disabled: !assignment.students.length || !assignment.assignDate || !assignment.dueDate || !assignment.title || !assignment.classroom,
|
|
248
|
+
children: t("assign")
|
|
249
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
250
|
+
color: "primary",
|
|
251
|
+
onClick: handleMenuOpen,
|
|
252
|
+
sx: {
|
|
253
|
+
minWidth: "40px",
|
|
254
|
+
padding: "6px"
|
|
255
|
+
},
|
|
256
|
+
disabled: !assignment.students.length || !assignment.assignDate || !assignment.dueDate || !assignment.title || !assignment.classroom,
|
|
257
|
+
children: anchorEl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropUp.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropDown.default, {})
|
|
258
|
+
})]
|
|
259
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popover, {
|
|
260
|
+
anchorEl: anchorEl,
|
|
261
|
+
open: Boolean(anchorEl),
|
|
262
|
+
onClose: handleMenuClose,
|
|
263
|
+
anchorOrigin: {
|
|
264
|
+
vertical: "top",
|
|
265
|
+
horizontal: "left"
|
|
266
|
+
},
|
|
267
|
+
transformOrigin: {
|
|
268
|
+
vertical: "bottom",
|
|
269
|
+
horizontal: "left"
|
|
270
|
+
},
|
|
271
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
272
|
+
display: "flex",
|
|
273
|
+
flexDirection: "column",
|
|
274
|
+
width: "100%",
|
|
275
|
+
gap: 1,
|
|
276
|
+
padding: 2,
|
|
277
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalizationProvider.LocalizationProvider, {
|
|
278
|
+
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
279
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, {
|
|
280
|
+
label: t("assign_date"),
|
|
281
|
+
value: assignment.assignDate,
|
|
282
|
+
onChange: date => setAssignment(prev => ({
|
|
283
|
+
...prev,
|
|
284
|
+
assignDate: date
|
|
285
|
+
}))
|
|
286
|
+
})
|
|
287
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
288
|
+
variant: "outlined",
|
|
289
|
+
color: "primary",
|
|
290
|
+
fullWidth: true,
|
|
291
|
+
children: t("schedule_assignment")
|
|
292
|
+
})]
|
|
293
|
+
})
|
|
294
|
+
})]
|
|
295
|
+
}), ";"]
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
CreateAssignmentScreen.propTypes = {
|
|
299
|
+
t: _propTypes.default.func.isRequired,
|
|
300
|
+
classrooms: _propTypes.default.array.isRequired,
|
|
301
|
+
open: _propTypes.default.bool.isRequired,
|
|
302
|
+
handleClose: _propTypes.default.func.isRequired
|
|
303
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _Assignment = _interopRequireDefault(require("../../Cards/Assignment/Assignment"));
|
|
11
|
+
var _Refresh = _interopRequireDefault(require("@mui/icons-material/Refresh"));
|
|
12
|
+
var _teacherCreate = _interopRequireDefault(require("../../img/teacher-create-2.svg"));
|
|
13
|
+
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const AssignmentCardsList = ({
|
|
17
|
+
t = text => text,
|
|
18
|
+
assignments = [],
|
|
19
|
+
isCreator,
|
|
20
|
+
onRefresh
|
|
21
|
+
}) => {
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
23
|
+
mt: 3,
|
|
24
|
+
mb: 1,
|
|
25
|
+
children: assignments.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
sx: {
|
|
29
|
+
mb: 1
|
|
30
|
+
},
|
|
31
|
+
display: "flex",
|
|
32
|
+
flexDirection: "column",
|
|
33
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
34
|
+
variant: "h5",
|
|
35
|
+
fontWeight: "bold",
|
|
36
|
+
sx: {
|
|
37
|
+
textAlign: "center",
|
|
38
|
+
flexGrow: 1
|
|
39
|
+
},
|
|
40
|
+
children: t("no_assignments")
|
|
41
|
+
}), !isCreator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
42
|
+
sx: {
|
|
43
|
+
textAlign: "center",
|
|
44
|
+
mt: 2
|
|
45
|
+
},
|
|
46
|
+
children: t("no_assignments_description")
|
|
47
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
48
|
+
sx: {
|
|
49
|
+
textAlign: "center",
|
|
50
|
+
mt: 2
|
|
51
|
+
},
|
|
52
|
+
children: t("assignments_description")
|
|
53
|
+
}), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
54
|
+
variant: "contained",
|
|
55
|
+
color: "primary",
|
|
56
|
+
sx: {
|
|
57
|
+
mt: 2,
|
|
58
|
+
textAlign: "center"
|
|
59
|
+
},
|
|
60
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {}),
|
|
61
|
+
children: t("create_assignment")
|
|
62
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
63
|
+
sx: {
|
|
64
|
+
height: "100%",
|
|
65
|
+
display: "flex",
|
|
66
|
+
flexGrow: 1,
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
maxWidth: "400px",
|
|
70
|
+
marginRight: "40px",
|
|
71
|
+
paddingTop: "20px"
|
|
72
|
+
},
|
|
73
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
74
|
+
src: _teacherCreate.default,
|
|
75
|
+
alt: "teacher-create"
|
|
76
|
+
})
|
|
77
|
+
})]
|
|
78
|
+
})
|
|
79
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
80
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
81
|
+
display: "flex",
|
|
82
|
+
justifyContent: "space-between",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
sx: {
|
|
85
|
+
mb: 2
|
|
86
|
+
},
|
|
87
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
88
|
+
variant: "h5",
|
|
89
|
+
children: t("assignments")
|
|
90
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
91
|
+
placement: "left",
|
|
92
|
+
title: t("refresh_assignments"),
|
|
93
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
94
|
+
onClick: onRefresh,
|
|
95
|
+
"aria-label": "refresh",
|
|
96
|
+
size: "large",
|
|
97
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Refresh.default, {})
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
}), assignments.map(assignment => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Assignment.default, {
|
|
101
|
+
assignment: assignment,
|
|
102
|
+
t: t,
|
|
103
|
+
isCreator: isCreator
|
|
104
|
+
}, assignment.id))]
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
AssignmentCardsList.propTypes = {
|
|
109
|
+
t: _propTypes.default.func,
|
|
110
|
+
assignments: _propTypes.default.array,
|
|
111
|
+
isCreator: _propTypes.default.bool,
|
|
112
|
+
onRefresh: _propTypes.default.func
|
|
113
|
+
};
|
|
114
|
+
var _default = exports.default = AssignmentCardsList;
|