5
5
6
6
import { Button , Card , Row , Col , Space } from "antd" ;
7
7
// React libraries and Components
8
- import {
9
- React ,
10
- Rendered ,
11
- useActions ,
12
- useStore ,
13
- } from "@cocalc/frontend/app-framework" ;
8
+ import { React , useActions , useStore } from "@cocalc/frontend/app-framework" ;
14
9
import { plural } from "@cocalc/util/misc" ;
15
10
import { Icon } from "@cocalc/frontend/components" ;
16
11
import { CourseActions } from "../actions" ;
17
12
import type { ProjectMap } from "@cocalc/frontend/todo-types" ;
18
- import { CourseSettingsRecord , CourseStore } from "../store" ;
13
+ import { CourseStore } from "../store" ;
19
14
import { DeleteAllStudentProjects } from "./delete-all-student-projects" ;
20
15
import { DeleteAllStudents } from "./delete-all-students" ;
21
- import { DeleteSharedProjectPanel } from "../shared-project/delete-shared-project" ;
22
16
import { TerminalCommandPanel } from "./terminal-command" ;
23
17
import { StudentProjectsStartStopPanel } from "./start-stop-panel" ;
24
18
import EmptyTrash from "./empty-trash" ;
25
19
import { RESEND_INVITE_INTERVAL_DAYS } from "@cocalc/util/consts/invites" ;
26
20
27
21
interface Props {
28
22
name : string ;
29
- settings : CourseSettingsRecord ;
30
23
project_map : ProjectMap ;
31
24
configuring_projects ?: boolean ;
32
25
reinviting_students ?: boolean ;
33
26
}
34
27
35
28
export const ActionsPanel : React . FC < Props > = React . memo (
36
- ( {
37
- name,
38
- settings,
39
- project_map,
40
- configuring_projects,
41
- reinviting_students,
42
- } ) => {
29
+ ( { name, project_map, configuring_projects, reinviting_students } ) => {
43
30
const actions = useActions < CourseActions > ( { name } ) ;
44
31
45
- function render_resend_outstanding_email_invites ( ) : Rendered {
46
- return (
47
- < Card
48
- title = {
49
- < >
50
- < Icon name = "envelope" /> Resend Outstanding Email Invites
51
- </ >
52
- }
53
- >
54
- Send another email to every student who didn't sign up yet. This sends
55
- a maximum of one email every { RESEND_INVITE_INTERVAL_DAYS } { " " }
56
- { plural ( RESEND_INVITE_INTERVAL_DAYS , "day" ) } .
57
- < hr />
58
- < Button
59
- disabled = { reinviting_students }
60
- onClick = { ( ) => {
61
- actions . student_projects . reinvite_oustanding_students ( ) ;
62
- } }
63
- >
64
- { reinviting_students ? < Icon name = "cocalc-ring" spin /> : undefined } { " " }
65
- Reinvite students
66
- </ Button >
67
- </ Card >
68
- ) ;
69
- }
70
-
71
- function render_push_missing_handouts_and_assignments ( ) : Rendered {
72
- return (
73
- < Card
74
- title = {
75
- < >
76
- < Icon name = "share-square" /> Copy Missing Handouts and Assignments
77
- </ >
78
- }
79
- >
80
- If you < b > add new students</ b > to your course, you can click this
81
- button to ensure they have all the assignments and handouts that you
82
- have already assigned to other students in the course.
83
- < hr />
84
- < Button
85
- onClick = { ( ) => {
86
- actions . configuration . push_missing_handouts_and_assignments ( ) ;
87
- } }
88
- >
89
- < Icon name = "share-square" /> Copy Missing Handouts and Assignments
90
- </ Button >
91
- </ Card >
92
- ) ;
93
- }
94
-
95
- function render_delete_shared_project ( ) {
96
- if ( settings . get ( "shared_project_id" ) ) {
97
- return (
98
- < DeleteSharedProjectPanel
99
- delete = { ( ) => actions . shared_project . delete ( ) }
100
- />
101
- ) ;
102
- }
103
- }
104
-
105
- function render_delete_student_projects ( ) {
106
- return (
107
- < DeleteAllStudentProjects
108
- deleteAllStudentProjects = {
109
- actions . student_projects . deleteAllStudentProjects
110
- }
111
- />
112
- ) ;
113
- }
114
-
115
- function render_delete_all_students ( ) {
116
- return (
117
- < DeleteAllStudents
118
- deleteAllStudents = { actions . students . deleteAllStudents }
119
- />
120
- ) ;
121
- }
122
-
123
32
return (
124
33
< div className = "smc-vfill" style = { { overflowY : "scroll" } } >
125
34
< Row >
@@ -136,17 +45,18 @@ export const ActionsPanel: React.FC<Props> = React.memo(
136
45
actions = { actions }
137
46
/>
138
47
< br />
139
- { render_resend_outstanding_email_invites ( ) }
48
+ < ResendInvites
49
+ actions = { actions }
50
+ reinviting_students = { reinviting_students }
51
+ />
140
52
< br />
141
- { render_push_missing_handouts_and_assignments ( ) }
53
+ < CopyMissingHandoutsAndAssignments actions = { actions } />
142
54
< br />
143
55
< EmptyTrash />
144
56
< br />
145
- { render_delete_student_projects ( ) }
57
+ < DeleteAllStudentProjects actions = { actions } />
146
58
< br />
147
- { render_delete_all_students ( ) }
148
- < br />
149
- { render_delete_shared_project ( ) }
59
+ < DeleteAllStudents actions = { actions } />
150
60
</ Col >
151
61
</ Row >
152
62
</ div >
@@ -252,3 +162,59 @@ export function ReconfigureAllProjects({
252
162
</ Card >
253
163
) ;
254
164
}
165
+
166
+ export function ResendInvites ( {
167
+ actions,
168
+ reinviting_students,
169
+ } : {
170
+ actions ;
171
+ reinviting_students ?;
172
+ } ) {
173
+ return (
174
+ < Card
175
+ title = {
176
+ < >
177
+ < Icon name = "envelope" /> Resend Outstanding Email Invites
178
+ </ >
179
+ }
180
+ >
181
+ Send another email to every student who didn't sign up yet. This sends a
182
+ maximum of one email every { RESEND_INVITE_INTERVAL_DAYS } { " " }
183
+ { plural ( RESEND_INVITE_INTERVAL_DAYS , "day" ) } .
184
+ < hr />
185
+ < Button
186
+ disabled = { reinviting_students }
187
+ onClick = { ( ) => {
188
+ actions . student_projects . reinvite_oustanding_students ( ) ;
189
+ } }
190
+ >
191
+ { reinviting_students ? < Icon name = "cocalc-ring" spin /> : undefined } { " " }
192
+ Reinvite students
193
+ </ Button >
194
+ </ Card >
195
+ ) ;
196
+ }
197
+
198
+ export function CopyMissingHandoutsAndAssignments ( { actions } ) {
199
+ return (
200
+ < Card
201
+ title = {
202
+ < >
203
+ < Icon name = "share-square" /> Copy Missing Handouts and Assignments
204
+ </ >
205
+ }
206
+ >
207
+ If you < b > add new students</ b > to your course, you can click this button
208
+ to ensure they have all the assignments and handouts that you have already
209
+ assigned to other students in the course.
210
+ < hr />
211
+ < Button
212
+ onClick = { ( ) => {
213
+ actions . configuration . push_missing_handouts_and_assignments ( ) ;
214
+ } }
215
+ >
216
+ < Icon name = "share-square" /> Copy Missing Handouts and Assignments
217
+ </ Button >
218
+ </ Card >
219
+ ) ;
220
+ }
0 commit comments