3
3
* License: MS-RSL – see LICENSE.md for details
4
4
*/
5
5
6
- import { Button , Col , Row , Space } from "antd" ;
6
+ import { Button , Col , Row , Space , Spin } from "antd" ;
7
7
import { ReactNode , useRef , useState } from "react" ;
8
8
import { useActions } from "@cocalc/frontend/app-framework" ;
9
9
import {
@@ -27,6 +27,8 @@ import {
27
27
} from "../store" ;
28
28
import { AssignmentCopyType } from "../types" ;
29
29
import { useButtonSize } from "../util" ;
30
+ import { webapp_client } from "@cocalc/frontend/webapp-client" ;
31
+ import { COPY_TIMEOUT_MS } from "@cocalc/frontend/course/consts" ;
30
32
31
33
interface StudentAssignmentInfoProps {
32
34
name : string ;
@@ -252,7 +254,7 @@ export function StudentAssignmentInfo({
252
254
const t = nbgrader_run_info . get (
253
255
assignment . get ( "assignment_id" ) + "-" + student . get ( "student_id" ) ,
254
256
) ;
255
- if ( t && Date . now ( ) - t <= 1000 * 60 * 10 ) {
257
+ if ( t && webapp_client . server_time ( ) - t <= 1000 * 60 * 10 ) {
256
258
// Time starting is set and it's also within the last few minutes.
257
259
// This "few minutes" is just in case -- we probably shouldn't need
258
260
// that at all ever, but it could make cocalc state usable in case of
@@ -264,7 +266,7 @@ export function StudentAssignmentInfo({
264
266
label = running ? (
265
267
< span >
266
268
{ " " }
267
- < Icon name = "cocalc-ring" spin /> Running nbgrader
269
+ < Spin /> Running nbgrader
268
270
</ span >
269
271
) : (
270
272
< span > { label } </ span >
@@ -279,7 +281,7 @@ export function StudentAssignmentInfo({
279
281
onClick = { ( ) => {
280
282
if (
281
283
clicked_nbgrader . current != null &&
282
- Date . now ( ) - clicked_nbgrader . current . valueOf ( ) <= 3000
284
+ webapp_client . server_time ( ) - clicked_nbgrader . current . valueOf ( ) <= 3000
283
285
) {
284
286
// User *just* clicked, and we want to avoid double click
285
287
// running nbgrader twice.
@@ -375,7 +377,7 @@ export function StudentAssignmentInfo({
375
377
</ div > ,
376
378
) ;
377
379
}
378
- return < Space > { v } </ Space > ;
380
+ return < Space wrap > { v } </ Space > ;
379
381
} else {
380
382
return (
381
383
< Button
@@ -419,9 +421,9 @@ export function StudentAssignmentInfo({
419
421
420
422
function render_open_copying ( name : Steps , open , stop ) {
421
423
return (
422
- < Space key = "open_copying" >
424
+ < Space key = "open_copying" wrap >
423
425
< Button key = "copy" disabled = { true } size = { size } >
424
- < Icon name = "cocalc-ring" spin /> { name } ing
426
+ < Spin /> { name } ing
425
427
</ Button >
426
428
< Button key = "stop" danger onClick = { stop } size = { size } >
427
429
Cancel < Icon name = "times" />
@@ -488,7 +490,7 @@ export function StudentAssignmentInfo({
488
490
const do_stop = ( ) => stop ( type , info . assignment_id , info . student_id ) ;
489
491
const v : JSX . Element [ ] = [ ] ;
490
492
if ( enable_copy ) {
491
- if ( data . start ) {
493
+ if ( webapp_client . server_time ( ) - ( data . start ?? 0 ) < COPY_TIMEOUT_MS ) {
492
494
v . push ( render_open_copying ( step , do_open , do_stop ) ) ;
493
495
} else if ( data . time ) {
494
496
v . push (
0 commit comments