@nualang/nualang-ui-components 0.1.1220 → 0.1.1222
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/Assignments/AssignmentCard/AssignmentCard.js +220 -0
- package/dist/Assignments/AssignmentCard/package.json +7 -0
- package/dist/Assignments/AssignmentCardsList/AssignmentCardsList.js +118 -0
- package/dist/Assignments/AssignmentCardsList/package.json +7 -0
- package/dist/Assignments/AssignmentCourseSelection/AssignmentCourseSelection.js +154 -0
- package/dist/Assignments/AssignmentCourseSelection/package.json +7 -0
- package/dist/Assignments/AssignmentExerciseSelection/AssignmentExerciseSelection.js +599 -0
- package/dist/Assignments/AssignmentExerciseSelection/package.json +7 -0
- package/dist/Assignments/AssignmentExerciseSelector/AssignmentExerciseSelector.js +36 -0
- package/dist/Assignments/AssignmentExerciseSelector/package.json +7 -0
- package/dist/Assignments/AssignmentRoleplaySelection/AssignmentRoleplaySelection.js +257 -0
- package/dist/Assignments/AssignmentRoleplaySelection/package.json +7 -0
- package/dist/Assignments/CreateAssignmentDialog/CreateAssignmentDialog.js +418 -0
- package/dist/Assignments/CreateAssignmentDialog/package.json +7 -0
- package/dist/Assignments/SelectAssignmentTypeDialog/SelectAssignmentTypeDialog.js +170 -0
- package/dist/Assignments/SelectAssignmentTypeDialog/package.json +7 -0
- package/dist/Cards/Category/Category.js +3 -3
- package/dist/Containers/App/App.js +10 -11
- package/dist/Forms/FeedbackForm/FeedbackForm.js +37 -0
- package/dist/Misc/AnswerResult/AnswerResult.js +3 -2
- package/dist/Navigation/ResponsiveDrawer/ResponsiveDrawer.js +62 -11
- package/dist/Navigation/_nav.js +3 -21
- package/dist/hooks/useRecognition.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = AssignmentCard;
|
|
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 AssignmentCard({
|
|
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
|
+
AssignmentCard.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
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
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 _AssignmentCard = _interopRequireDefault(require("../AssignmentCard/AssignmentCard"));
|
|
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
|
+
handleCreateAssignment
|
|
22
|
+
}) => {
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
24
|
+
mt: 3,
|
|
25
|
+
mb: 1,
|
|
26
|
+
children: assignments.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
27
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
sx: {
|
|
30
|
+
mb: 1
|
|
31
|
+
},
|
|
32
|
+
display: "flex",
|
|
33
|
+
flexDirection: "column",
|
|
34
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
35
|
+
variant: "h5",
|
|
36
|
+
fontWeight: "bold",
|
|
37
|
+
sx: {
|
|
38
|
+
textAlign: "center",
|
|
39
|
+
flexGrow: 1
|
|
40
|
+
},
|
|
41
|
+
children: t("no_assignments")
|
|
42
|
+
}), !isCreator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
43
|
+
sx: {
|
|
44
|
+
textAlign: "center",
|
|
45
|
+
mt: 2,
|
|
46
|
+
width: '70%'
|
|
47
|
+
},
|
|
48
|
+
children: t("no_assignments_description")
|
|
49
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
50
|
+
sx: {
|
|
51
|
+
textAlign: "center",
|
|
52
|
+
mt: 2,
|
|
53
|
+
width: '70%'
|
|
54
|
+
},
|
|
55
|
+
children: t("assignments_description")
|
|
56
|
+
}), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
57
|
+
variant: "contained",
|
|
58
|
+
color: "primary",
|
|
59
|
+
sx: {
|
|
60
|
+
mt: 2,
|
|
61
|
+
textAlign: "center"
|
|
62
|
+
},
|
|
63
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {}),
|
|
64
|
+
onClick: handleCreateAssignment,
|
|
65
|
+
children: t("create_assignment")
|
|
66
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
67
|
+
sx: {
|
|
68
|
+
height: "100%",
|
|
69
|
+
display: "flex",
|
|
70
|
+
flexGrow: 1,
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
justifyContent: "center",
|
|
73
|
+
maxWidth: "400px",
|
|
74
|
+
marginRight: "40px",
|
|
75
|
+
paddingTop: "20px"
|
|
76
|
+
},
|
|
77
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
78
|
+
src: _teacherCreate.default,
|
|
79
|
+
alt: "teacher-create"
|
|
80
|
+
})
|
|
81
|
+
})]
|
|
82
|
+
})
|
|
83
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
84
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
85
|
+
display: "flex",
|
|
86
|
+
justifyContent: "space-between",
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
sx: {
|
|
89
|
+
mb: 2
|
|
90
|
+
},
|
|
91
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
92
|
+
variant: "h5",
|
|
93
|
+
children: t("assignments")
|
|
94
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
95
|
+
placement: "left",
|
|
96
|
+
title: t("refresh_assignments"),
|
|
97
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
98
|
+
onClick: onRefresh,
|
|
99
|
+
"aria-label": "refresh",
|
|
100
|
+
size: "large",
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Refresh.default, {})
|
|
102
|
+
})
|
|
103
|
+
})]
|
|
104
|
+
}), assignments.map(assignment => /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentCard.default, {
|
|
105
|
+
assignment: assignment,
|
|
106
|
+
t: t,
|
|
107
|
+
isCreator: isCreator
|
|
108
|
+
}, assignment.id))]
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
AssignmentCardsList.propTypes = {
|
|
113
|
+
t: _propTypes.default.func,
|
|
114
|
+
assignments: _propTypes.default.array,
|
|
115
|
+
isCreator: _propTypes.default.bool,
|
|
116
|
+
onRefresh: _propTypes.default.func
|
|
117
|
+
};
|
|
118
|
+
var _default = exports.default = AssignmentCardsList;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _material = require("@mui/material");
|
|
9
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
10
|
+
var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
|
|
11
|
+
var _AssignmentExerciseSelection = _interopRequireDefault(require("../AssignmentExerciseSelection/AssignmentExerciseSelection"));
|
|
12
|
+
var _Queries = require("@nualang/nualang-api-and-queries/Queries");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function Course({
|
|
16
|
+
course,
|
|
17
|
+
index,
|
|
18
|
+
getCourseSections,
|
|
19
|
+
getRoleplays,
|
|
20
|
+
username,
|
|
21
|
+
handleCreateGame,
|
|
22
|
+
t,
|
|
23
|
+
isExerciseSelected,
|
|
24
|
+
setIsExerciseSelected,
|
|
25
|
+
isDialogOpen,
|
|
26
|
+
handleSelectExercise,
|
|
27
|
+
selectedExercises,
|
|
28
|
+
useCase,
|
|
29
|
+
assignment,
|
|
30
|
+
handleStartExercise,
|
|
31
|
+
isAssignment,
|
|
32
|
+
isCreator
|
|
33
|
+
}) {
|
|
34
|
+
const [open, setOpen] = (0, _react.useState)(false);
|
|
35
|
+
const sectionsQuery = _Queries.courses.useCourseSections(async (courseId, filters) => {
|
|
36
|
+
const response = await getCourseSections(courseId, filters);
|
|
37
|
+
return response;
|
|
38
|
+
}, {
|
|
39
|
+
courseId: course.courseId,
|
|
40
|
+
username: username,
|
|
41
|
+
filters: {
|
|
42
|
+
limit: 1000
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
enabled: !!course.courseId && isDialogOpen
|
|
46
|
+
});
|
|
47
|
+
const courseSections = (0, _react.useMemo)(() => sectionsQuery.isSuccess && Array.isArray(sectionsQuery.data.Items) && sectionsQuery.data.Items.length ? sectionsQuery.data.Items : [], [sectionsQuery.data, sectionsQuery.isSuccess]);
|
|
48
|
+
const isCourseEmpty = courseSections.length === 0 && !sectionsQuery.isLoading ? true : false;
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.List, {
|
|
50
|
+
disablePadding: true,
|
|
51
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
52
|
+
title: isCourseEmpty ? t("course_no_sections") : "",
|
|
53
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {
|
|
54
|
+
disablePadding: true,
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemButton, {
|
|
56
|
+
onClick: () => setOpen(!open),
|
|
57
|
+
disabled: isCourseEmpty || isExerciseSelected,
|
|
58
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
59
|
+
display: "flex",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
justifyContent: "space-between",
|
|
62
|
+
width: "100%",
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
64
|
+
display: "flex",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
67
|
+
src: course.picture,
|
|
68
|
+
alt: ""
|
|
69
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
70
|
+
primary: course.courseName,
|
|
71
|
+
secondary: course.description,
|
|
72
|
+
sx: {
|
|
73
|
+
marginLeft: 2
|
|
74
|
+
}
|
|
75
|
+
})]
|
|
76
|
+
}), open ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {
|
|
77
|
+
sx: {
|
|
78
|
+
color: "#757575"
|
|
79
|
+
}
|
|
80
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {
|
|
81
|
+
sx: {
|
|
82
|
+
color: "#757575"
|
|
83
|
+
}
|
|
84
|
+
})]
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Collapse, {
|
|
89
|
+
in: open,
|
|
90
|
+
timeout: "auto",
|
|
91
|
+
unmountOnExit: true,
|
|
92
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
93
|
+
ml: 3.5,
|
|
94
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssignmentExerciseSelection.default, {
|
|
95
|
+
t: t,
|
|
96
|
+
sections: courseSections,
|
|
97
|
+
isLoading: sectionsQuery.isLoading,
|
|
98
|
+
handleCreateGame: handleCreateGame,
|
|
99
|
+
courseId: course.courseId,
|
|
100
|
+
isExerciseSelected: isExerciseSelected,
|
|
101
|
+
setIsExerciseSelected: setIsExerciseSelected,
|
|
102
|
+
getRoleplays: getRoleplays,
|
|
103
|
+
handleSelectExercise: handleSelectExercise,
|
|
104
|
+
selectedExercises: selectedExercises,
|
|
105
|
+
useCase: useCase,
|
|
106
|
+
assignment: assignment,
|
|
107
|
+
handleStartExercise: handleStartExercise,
|
|
108
|
+
isAssignment: isAssignment,
|
|
109
|
+
isCreator: isCreator
|
|
110
|
+
})
|
|
111
|
+
})
|
|
112
|
+
})]
|
|
113
|
+
}, index);
|
|
114
|
+
}
|
|
115
|
+
function AssignmentCourseSelection({
|
|
116
|
+
courses,
|
|
117
|
+
getCourseSections,
|
|
118
|
+
getRoleplays,
|
|
119
|
+
username,
|
|
120
|
+
handleCreateGame,
|
|
121
|
+
t,
|
|
122
|
+
isExerciseSelected,
|
|
123
|
+
setIsExerciseSelected,
|
|
124
|
+
handleSelectExercise,
|
|
125
|
+
selectedExercises,
|
|
126
|
+
useCase,
|
|
127
|
+
assignment,
|
|
128
|
+
handleStartExercise,
|
|
129
|
+
isAssignment,
|
|
130
|
+
isCreator,
|
|
131
|
+
...otherProps
|
|
132
|
+
}) {
|
|
133
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
134
|
+
children: courses.map((course, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Course, {
|
|
135
|
+
course: course,
|
|
136
|
+
index: index,
|
|
137
|
+
getCourseSections: getCourseSections,
|
|
138
|
+
getRoleplays: getRoleplays,
|
|
139
|
+
username: username,
|
|
140
|
+
handleCreateGame: handleCreateGame,
|
|
141
|
+
t: t,
|
|
142
|
+
isExerciseSelected: isExerciseSelected,
|
|
143
|
+
setIsExerciseSelected: setIsExerciseSelected,
|
|
144
|
+
handleSelectExercise: handleSelectExercise,
|
|
145
|
+
selectedExercises: selectedExercises,
|
|
146
|
+
useCase: useCase,
|
|
147
|
+
assignment: assignment,
|
|
148
|
+
handleStartExercise: handleStartExercise,
|
|
149
|
+
isAssignment: isAssignment,
|
|
150
|
+
isCreator: isCreator
|
|
151
|
+
}))
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
var _default = exports.default = AssignmentCourseSelection;
|