33 * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
44 */
55
6- import { Alert , Modal , Space , Tag } from "antd" ;
6+ import { Alert , Modal , Space , Tag , Tooltip } from "antd" ;
77import humanizeList from "humanize-list" ;
88import { join } from "path" ;
9-
9+ import { useInterval } from "react-interval-hook" ;
1010import {
1111 CSS ,
1212 React ,
1313 redux ,
14- useEffect ,
1514 useForceUpdate ,
1615 useMemo ,
1716 useRef ,
@@ -387,11 +386,7 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
387386 const openFiles = useTypedRedux ( { project_id } , "open_files_order" ) ;
388387 const triggered = useRef < boolean > ( false ) ;
389388 const update = useForceUpdate ( ) ;
390-
391- useEffect ( ( ) => {
392- const interval = setInterval ( update , 1000 ) ;
393- return ( ) => clearInterval ( interval ) ;
394- } , [ ] ) ;
389+ useInterval ( update , 1000 ) ;
395390
396391 if (
397392 status . get ( "state" ) !== "running" ||
@@ -404,7 +399,9 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
404399
405400 // start_ts is e.g. 1508576664416
406401 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+ }
408405
409406 const shutdown_ts = start_ts + 1000 * 60 * limit_min ;
410407 const countdown = shutdown_ts - server_time ( ) . getTime ( ) ;
@@ -449,7 +446,7 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
449446 < A href = { BUY_A_LICENSE_URL } > purchasing a license</ A > .
450447 </ Paragraph >
451448 < Paragraph >
452- Behind this curtains ,{ " " }
449+ Behind the curtain ,{ " " }
453450 < A href = { "/about/team" } > humans are working hard</ A > to keep the
454451 service running and improving it constantly. Your files and
455452 computations < A href = { "/info/status" } > run in our cluster</ A > ,
@@ -470,7 +467,8 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
470467 >
471468 Contact us
472469 </ 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.
474472 </ Paragraph >
475473 </ >
476474 }
@@ -482,30 +480,31 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
482480 return (
483481 < >
484482 { 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 >
509508 </ >
510509 ) ;
511510}
0 commit comments