Skip to content

Commit 281c9a9

Browse files
committed
course: add handouts menu item
1 parent b4e0a9c commit 281c9a9

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Button } from "../../antd-bootstrap";
1919
import { Icon, Tip } from "../../components";
2020
import { UserMap } from "../../todo-types";
2121
import { CourseActions } from "../actions";
22-
import { FoldersToolbar } from "../common";
22+
import { AddItems, FoldersToolbar } from "../common/folders-tool-bar";
2323
import { HandoutRecord, HandoutsMap, StudentsMap } from "../store";
2424
import * as styles from "../styles";
2525
// CoCalc and course components
@@ -237,3 +237,24 @@ export function HandoutsPanelHeader(props: { n: number }) {
237237
</Tip>
238238
);
239239
}
240+
241+
// used for adding assignments outside of the above component.
242+
export function AddHandouts({ name, actions }) {
243+
const handouts = useRedux(name, "handouts");
244+
return (
245+
<AddItems
246+
itemName="handout"
247+
items={handouts}
248+
addItems={actions.assignments.addHandout}
249+
selectorStyle={{
250+
position: null,
251+
width: "100%",
252+
boxShadow: null,
253+
zIndex: null,
254+
backgroundColor: null,
255+
}}
256+
defaultOpen
257+
closable={false}
258+
/>
259+
);
260+
}

src/packages/frontend/course/modals.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
import { Parallel } from "@cocalc/frontend/course/configuration/parallel";
3030
import { Nbgrader } from "@cocalc/frontend/course/configuration/nbgrader";
3131
import { AddAssignments } from "@cocalc/frontend/course/assignments/assignments-panel";
32+
import { AddHandouts } from "@cocalc/frontend/course/handouts/handouts-panel";
3233

3334
interface Props {
3435
frameActions;
@@ -89,7 +90,13 @@ function getModal(modal: string) {
8990
case "add-students":
9091
return { Body: AddStudents, title: "Add Students", icon: "users" };
9192
case "add-assignments":
92-
return { Body: AddAssignments, title: "Add Assignemtns", icon: "share-square" };
93+
return {
94+
Body: AddAssignments,
95+
title: "Add Assignmetns",
96+
icon: "share-square",
97+
};
98+
case "add-handouts":
99+
return { Body: AddHandouts, title: "Add Handouts", icon: "text1" };
93100

94101
case "start-all-projects":
95102
return {

src/packages/frontend/frame-editors/course-editor/editor.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ const COURSE_MENUS = {
4040
label: menu.edit,
4141
pos: 1,
4242
entries: {
43-
editStudents: ["course-add-students", "course-add-assignments"],
43+
editStudents: [
44+
"course-add-students",
45+
"course-add-assignments",
46+
"course-add-handouts",
47+
],
4448
courseUpgrades: ["course-upgrades"],
4549
configCourse: [
4650
"course-title-and-description",
@@ -106,6 +110,16 @@ const COMMANDS = {
106110
actions.setModal("add-assignments");
107111
},
108112
},
113+
"course-add-handouts": {
114+
icon: "text1",
115+
label: "Add Handouts",
116+
button: "+Handouts",
117+
title: "Add one or more handouts to this course.",
118+
onClick: ({ props }) => {
119+
const { actions } = props;
120+
actions.setModal("add-handouts");
121+
},
122+
},
109123
"course-title-and-description": {
110124
icon: "header",
111125
label: "Course Title and Description",

0 commit comments

Comments
 (0)