3
3
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
4
4
*/
5
5
6
- import { Alert , Modal , Space , Tag } from "antd" ;
6
+ import { Alert , Modal , Space , Tag , Tooltip } from "antd" ;
7
7
import humanizeList from "humanize-list" ;
8
8
import { join } from "path" ;
9
-
9
+ import { useInterval } from "react-interval-hook" ;
10
10
import {
11
11
CSS ,
12
12
React ,
13
13
redux ,
14
- useEffect ,
15
14
useForceUpdate ,
16
15
useMemo ,
17
16
useRef ,
@@ -387,11 +386,7 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
387
386
const openFiles = useTypedRedux ( { project_id } , "open_files_order" ) ;
388
387
const triggered = useRef < boolean > ( false ) ;
389
388
const update = useForceUpdate ( ) ;
390
-
391
- useEffect ( ( ) => {
392
- const interval = setInterval ( update , 1000 ) ;
393
- return ( ) => clearInterval ( interval ) ;
394
- } , [ ] ) ;
389
+ useInterval ( update , 1000 ) ;
395
390
396
391
if (
397
392
status . get ( "state" ) !== "running" ||
@@ -404,7 +399,9 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
404
399
405
400
// start_ts is e.g. 1508576664416
406
401
const start_ts = project . getIn ( [ "status" , "start_ts" ] ) ;
407
- if ( start_ts == undefined ) return null ;
402
+ if ( start_ts == null && ! showInfo ) {
403
+ return null ;
404
+ }
408
405
409
406
const shutdown_ts = start_ts + 1000 * 60 * limit_min ;
410
407
const countdown = shutdown_ts - server_time ( ) . getTime ( ) ;
@@ -449,7 +446,7 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
449
446
< A href = { BUY_A_LICENSE_URL } > purchasing a license</ A > .
450
447
</ Paragraph >
451
448
< Paragraph >
452
- Behind this curtains ,{ " " }
449
+ Behind the curtain ,{ " " }
453
450
< A href = { "/about/team" } > humans are working hard</ A > to keep the
454
451
service running and improving it constantly. Your files and
455
452
computations < A href = { "/info/status" } > run in our cluster</ A > ,
@@ -470,7 +467,8 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
470
467
>
471
468
Contact us
472
469
</ A > { " " }
473
- if you can give support in other ways.
470
+ if you can give support in other ways or have any questions or
471
+ comments.
474
472
</ Paragraph >
475
473
</ >
476
474
}
@@ -482,30 +480,31 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
482
480
return (
483
481
< >
484
482
{ renderInfo ( ) }
485
- < Tag
486
- style = { {
487
- marginTop : "5px" ,
488
- fontSize,
489
- float : "right" ,
490
- fontWeight : "bold" ,
491
- color : COLORS . ANTD_RED ,
492
- cursor : "pointer" ,
493
- } }
494
- color = { COLORS . GRAY_LL }
495
- onClick = { ( ) => {
496
- setShowInfo ( true ) ;
497
- track ( "trial-banner" , { what : "countdown" , project_id } ) ;
498
- } }
499
- >
500
- < TimeAmount
501
- key = { "time" }
502
- amount = { countdwon0 }
503
- compact = { true }
504
- showIcon = { true }
505
- countdown = { countdwon0 }
506
- style = { { color : COLORS . ANTD_RED } }
507
- />
508
- </ Tag >
483
+ < Tooltip title = "Automatic Project Shutdown: click for details..." >
484
+ < Tag
485
+ style = { {
486
+ marginTop : "5px" ,
487
+ fontSize,
488
+ float : "right" ,
489
+ fontWeight : "bold" ,
490
+ cursor : "pointer" ,
491
+ } }
492
+ color = { "red" }
493
+ onClick = { ( ) => {
494
+ setShowInfo ( true ) ;
495
+ track ( "trial-banner" , { what : "countdown" , project_id } ) ;
496
+ } }
497
+ >
498
+ < TimeAmount
499
+ key = { "time" }
500
+ amount = { countdwon0 }
501
+ compact = { true }
502
+ showIcon = { true }
503
+ countdown = { countdwon0 }
504
+ style = { { color : COLORS . ANTD_RED } }
505
+ />
506
+ </ Tag >
507
+ </ Tooltip >
509
508
</ >
510
509
) ;
511
510
}
0 commit comments