File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 11import type { FunctionComponent } from 'preact' ;
2+ import { useEffect , useState } from 'preact/compat' ;
23
34const dayLeftString = ( days : number ) : string => {
45 if ( days === 0 ) {
@@ -10,15 +11,29 @@ const dayLeftString = (days: number): string => {
1011 }
1112} ;
1213
13- const Promo : FunctionComponent = ( ) => {
14+ const computeDaysLeft = ( ) => {
1415 const now = Date . now ( ) ;
15- const daysLeft = Math . floor ( ( 1752735600000 - now ) / ( 86400 * 1000 ) ) ;
16+ return Math . floor ( ( 1752735600000 - now ) / 86_400_000 ) ;
17+ } ;
18+
19+ const Promo : FunctionComponent = ( ) => {
20+ const [ daysLeft , setDaysLeft ] = useState ( computeDaysLeft ) ;
21+ useEffect ( ( ) => {
22+ const intervalId = setInterval (
23+ ( ) => setDaysLeft ( computeDaysLeft ( ) ) ,
24+ 60_000
25+ ) ;
26+ return ( ) => clearInterval ( intervalId ) ;
27+ } , [ ] ) ;
1628 if ( daysLeft < 0 ) {
1729 return null ;
1830 } else {
1931 return (
2032 < p class = "votenote" >
21- < strong > { dayLeftString ( daysLeft ) } </ strong > Please consider{ ' ' }
33+ < strong class = { daysLeft < 2 ? 'verystrong' : undefined } >
34+ { dayLeftString ( daysLeft ) }
35+ </ strong >
36+ { ' Please consider ' }
2237 < a target = "_blank" href = "https://www.youtube.com/shorts/4h8mYt6qnlw" >
2338 voting for Jaspinko in the GeoGuessr Remix challenge
2439 </ a >
Original file line number Diff line number Diff line change 5959 --main-bg-color : # 222 ;
6060 --main-text-color : # ffe ;
6161 --error-color : # e77 ;
62+ --secondary-text-color : # cca ;
6263 font-family : 'Inter' , sans-serif;
6364 font-optical-sizing : auto;
6465 font-weight : 300 ;
101102 font-weight : 550 ;
102103}
103104
105+ strong .verystrong {
106+ font-weight : 800 ;
107+ }
108+
104109.selector {
105110 display : flex;
106111 flex-direction : row;
121126
122127.hint {
123128 font-size : 0.75em ;
124- color : # cca ;
129+ color : var ( --secondary-text-color ) ;
125130}
126131
127132# game-params input : not ([type ]),
You can’t perform that action at this time.
0 commit comments