Skip to content

Commit a4037f7

Browse files
committed
course: better add handouts/assignments alert
1 parent 93ff101 commit a4037f7

File tree

4 files changed

+70
-32
lines changed

4 files changed

+70
-32
lines changed

src/packages/frontend/course/assignments/assignments-panel.tsx

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,20 @@ interface Props {
3838
assignments: Map<string, AssignmentRecord>;
3939
students: Map<string, StudentRecord>;
4040
user_map: object;
41+
frameActions;
4142
}
4243

4344
export function AssignmentsPanel(props: Props) {
44-
const { frame_id, name, project_id, redux, assignments, students, user_map } =
45-
props;
45+
const {
46+
frame_id,
47+
name,
48+
project_id,
49+
redux,
50+
assignments,
51+
students,
52+
user_map,
53+
frameActions,
54+
} = props;
4655

4756
const course_actions = useActions<CourseActions>({ name });
4857

@@ -204,30 +213,40 @@ export function AssignmentsPanel(props: Props) {
204213
}
205214

206215
function render_no_assignments() {
207-
const message = (
208-
<div>
209-
<h3>Add an Assignment to your Course</h3>
210-
<p>
211-
An assignment is a <i>directory</i> of files somewhere in your CoCalc
212-
project. You copy the assignment to your students and they work on it;
213-
later, you collect it, grade it, and return the graded version to
214-
them.
215-
</p>
216-
<p>
217-
Add assignments to your course by clicking "Add Assignment..." above.
218-
You can create and select one or more directories and they will become
219-
assignments that you can then customize and distribute to your
220-
students.
221-
</p>
222-
</div>
223-
);
224-
225216
return (
226217
<div>
227218
<Alert
228219
type="info"
229-
style={{ margin: "auto", fontSize: "12pt", maxWidth: "800px" }}
230-
message={message}
220+
style={{
221+
margin: "15px auto",
222+
fontSize: "12pt",
223+
maxWidth: "800px",
224+
}}
225+
message={
226+
<b>
227+
<a onClick={() => frameActions.setModal("add-assignments")}>
228+
Add Assignments to your Course
229+
</a>
230+
</b>
231+
}
232+
description={
233+
<div>
234+
<p>
235+
An assignment is a <i>directory</i> of files somewhere in your
236+
CoCalc project. You copy the assignment to your students and
237+
they work on it; later, you collect it, grade it, and return the
238+
graded version to them.
239+
</p>
240+
<p>
241+
<a onClick={() => frameActions.setModal("add-assignments")}>
242+
Add assignments to your course
243+
</a>{" "}
244+
by clicking "Add Assignment..." above. You can create and select
245+
one or more directories and they will become assignments that
246+
you can then customize and distribute to your students.
247+
</p>
248+
</div>
249+
}
231250
/>
232251
</div>
233252
);

src/packages/frontend/course/handouts/handouts-panel.tsx

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ interface HandoutsPanelReactProps {
2727
handouts: HandoutsMap; // handout_id -> handout
2828
students: StudentsMap; // student_id -> student
2929
user_map: UserMap;
30+
frameActions;
3031
}
3132

3233
export function HandoutsPanel({
@@ -37,14 +38,15 @@ export function HandoutsPanel({
3738
handouts,
3839
students,
3940
user_map,
41+
frameActions,
4042
}: HandoutsPanelReactProps) {
4143
const expanded_handouts: Set<string> | undefined = useRedux(
4244
name,
4345
"expanded_handouts",
4446
);
4547

4648
const [show_deleted, set_show_deleted] = useState<boolean>(false);
47-
49+
4850
const pageFilter = useRedux(name, "pageFilter");
4951
const filter = pageFilter?.get("handouts") ?? "";
5052
const setFilter = (filter: string) => {
@@ -158,21 +160,32 @@ export function HandoutsPanel({
158160
<div>
159161
<Alert
160162
type="info"
161-
style={{ margin: "auto", fontSize: "12pt", maxWidth: "800px" }}
163+
style={{
164+
margin: "15px auto",
165+
fontSize: "12pt",
166+
maxWidth: "800px",
167+
}}
162168
message={
169+
<b>
170+
<a onClick={() => frameActions.setModal("add-handouts")}>
171+
Add Handouts to your Course
172+
</a>
173+
</b>
174+
}
175+
description={
163176
<div>
164-
<h3>Add a Handout to your Course</h3>
165177
<p>
166178
A handout is a <i>directory</i> of files somewhere in your
167179
CoCalc project, which you copy to all of your students. They can
168180
then do anything they want with that handout.
169181
</p>
170-
171182
<p>
172-
Add handouts to your course by clicking "Add Handout..." above.
173-
You can create or select one or more directories and they will
174-
become handouts that you can then customize and distribute to
175-
your students.
183+
<a onClick={() => frameActions.setModal("add-handouts")}>
184+
Add handouts to your course
185+
</a>{" "}
186+
by clicking "Add Handout..." above. You can create or select one
187+
or more directories and they will become handouts that you can
188+
then customize and distribute to your students.
176189
</p>
177190
</div>
178191
}

src/packages/frontend/course/modals.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function getModal(modal: string) {
9393
case "add-assignments":
9494
return {
9595
Body: AddAssignments,
96-
title: "Add Assignmetns",
96+
title: "Add Assignments",
9797
icon: "share-square",
9898
};
9999
case "add-handouts":

src/packages/frontend/course/students/students-panel.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,13 @@ export function StudentsPanel({
340340
fontSize: "12pt",
341341
maxWidth: "800px",
342342
}}
343-
message={<b>Add Students to your Course</b>}
343+
message={
344+
<b>
345+
<a onClick={() => frameActions.setModal("add-students")}>
346+
Add Students to your Course
347+
</a>
348+
</b>
349+
}
344350
description={
345351
<div>
346352
<a onClick={() => frameActions.setModal("add-students")}>

0 commit comments

Comments
 (0)