|
3 | 3 | * License: MS-RSL – see LICENSE.md for details
|
4 | 4 | */
|
5 | 5 |
|
6 |
| -import { Card, Row, Col } from "antd"; |
| 6 | +import { Button, Card, Row, Col, Space } from "antd"; |
7 | 7 | // React libraries and Components
|
8 | 8 | import {
|
9 | 9 | React,
|
10 | 10 | Rendered,
|
11 | 11 | useActions,
|
12 | 12 | useStore,
|
13 | 13 | } from "@cocalc/frontend/app-framework";
|
14 |
| -import { Button, ButtonGroup } from "@cocalc/frontend/antd-bootstrap"; |
15 | 14 | import { plural } from "@cocalc/util/misc";
|
16 | 15 | import { Icon } from "@cocalc/frontend/components";
|
17 | 16 | import { CourseActions } from "../actions";
|
@@ -43,62 +42,6 @@ export const ActionsPanel: React.FC<Props> = React.memo(
|
43 | 42 | }) => {
|
44 | 43 | const actions = useActions<CourseActions>({ name });
|
45 | 44 |
|
46 |
| - /* |
47 |
| - * Grade export |
48 |
| - */ |
49 |
| - function render_grades_header() { |
50 |
| - return ( |
51 |
| - <> |
52 |
| - <Icon name="table" /> Export Grades |
53 |
| - </> |
54 |
| - ); |
55 |
| - } |
56 |
| - |
57 |
| - async function save_grades_to_csv() { |
58 |
| - await actions.export.to_csv(); |
59 |
| - } |
60 |
| - |
61 |
| - async function save_grades_to_py() { |
62 |
| - await actions.export.to_py(); |
63 |
| - } |
64 |
| - |
65 |
| - async function save_grades_to_json() { |
66 |
| - await actions.export.to_json(); |
67 |
| - } |
68 |
| - |
69 |
| - function render_export_grades() { |
70 |
| - return ( |
71 |
| - <Card title={render_grades_header()}> |
72 |
| - <div style={{ marginBottom: "10px" }}>Save grades to... </div> |
73 |
| - <ButtonGroup> |
74 |
| - <Button onClick={save_grades_to_csv}> |
75 |
| - <Icon name="csv" /> CSV file... |
76 |
| - </Button> |
77 |
| - <Button onClick={save_grades_to_json}> |
78 |
| - <Icon name="file-code" /> JSON file... |
79 |
| - </Button> |
80 |
| - <Button onClick={save_grades_to_py}> |
81 |
| - <Icon name="file-code" /> Python file... |
82 |
| - </Button> |
83 |
| - </ButtonGroup> |
84 |
| - <hr /> |
85 |
| - <div style={{ color: "#666" }}> |
86 |
| - Export all the grades you have recorded for students in your course |
87 |
| - to a csv or Python file. |
88 |
| - <br /> |
89 |
| - In Microsoft Excel, you can{" "} |
90 |
| - <a |
91 |
| - target="_blank" |
92 |
| - href="https://support.office.com/en-us/article/Import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba" |
93 |
| - > |
94 |
| - import the CSV file |
95 |
| - </a> |
96 |
| - . |
97 |
| - </div> |
98 |
| - </Card> |
99 |
| - ); |
100 |
| - } |
101 |
| - |
102 | 45 | function render_resend_outstanding_email_invites(): Rendered {
|
103 | 46 | return (
|
104 | 47 | <Card
|
@@ -177,19 +120,15 @@ export const ActionsPanel: React.FC<Props> = React.memo(
|
177 | 120 | );
|
178 | 121 | }
|
179 | 122 |
|
180 |
| - function render_terminal_command() { |
181 |
| - return <TerminalCommandPanel name={name} />; |
182 |
| - } |
183 |
| - |
184 | 123 | return (
|
185 | 124 | <div className="smc-vfill" style={{ overflowY: "scroll" }}>
|
186 | 125 | <Row>
|
187 | 126 | <Col md={12} style={{ padding: "15px 15px 15px 0" }}>
|
188 | 127 | <StartAllProjects name={name} project_map={project_map} />
|
189 | 128 | <br />
|
190 |
| - {render_terminal_command()} |
| 129 | + <TerminalCommandPanel name={name} /> |
191 | 130 | <br />
|
192 |
| - {render_export_grades()} |
| 131 | + <ExportGrades actions={actions} /> |
193 | 132 | </Col>
|
194 | 133 | <Col md={12} style={{ padding: "15px" }}>
|
195 | 134 | <ReconfigureAllProjects
|
@@ -228,6 +167,60 @@ export function StartAllProjects({ name, project_map }) {
|
228 | 167 | );
|
229 | 168 | }
|
230 | 169 |
|
| 170 | +export function ExportGrades({ actions, close }: { actions; close? }) { |
| 171 | + async function save_grades_to_csv() { |
| 172 | + await actions.export.to_csv(); |
| 173 | + close?.(); |
| 174 | + } |
| 175 | + |
| 176 | + async function save_grades_to_py() { |
| 177 | + await actions.export.to_py(); |
| 178 | + close?.(); |
| 179 | + } |
| 180 | + |
| 181 | + async function save_grades_to_json() { |
| 182 | + await actions.export.to_json(); |
| 183 | + close?.(); |
| 184 | + } |
| 185 | + |
| 186 | + return ( |
| 187 | + <Card |
| 188 | + title={ |
| 189 | + <> |
| 190 | + <Icon name="table" /> Export Grades |
| 191 | + </> |
| 192 | + } |
| 193 | + > |
| 194 | + <div style={{ marginBottom: "10px" }}>Save grades to... </div> |
| 195 | + <Space> |
| 196 | + <Button onClick={save_grades_to_csv}> |
| 197 | + <Icon name="csv" /> CSV file... |
| 198 | + </Button> |
| 199 | + <Button onClick={save_grades_to_json}> |
| 200 | + <Icon name="file-code" /> JSON file... |
| 201 | + </Button> |
| 202 | + <Button onClick={save_grades_to_py}> |
| 203 | + <Icon name="file-code" /> Python file... |
| 204 | + </Button> |
| 205 | + </Space> |
| 206 | + <hr /> |
| 207 | + <div style={{ color: "#666" }}> |
| 208 | + Export all the grades you have recorded for students in your course to a |
| 209 | + csv or Python file. |
| 210 | + <br /> |
| 211 | + In Microsoft Excel, you can{" "} |
| 212 | + <a |
| 213 | + target="_blank" |
| 214 | + href="https://support.office.com/en-us/article/Import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba" |
| 215 | + > |
| 216 | + import the CSV file |
| 217 | + </a> |
| 218 | + . |
| 219 | + </div> |
| 220 | + </Card> |
| 221 | + ); |
| 222 | +} |
| 223 | + |
231 | 224 | export function ReconfigureAllProjects({
|
232 | 225 | actions,
|
233 | 226 | configuring_projects,
|
|
0 commit comments