@@ -4,7 +4,7 @@ import socket from '../../socket'
4
4
import { openExternalBrowser } from '../../utils/browse'
5
5
import { emptyFen } from '../../utils/fen'
6
6
import { hasNetwork } from '../../utils'
7
- import i18n , { plural , formatNumber , fromNow } from '../../i18n'
7
+ import i18n , { plural , formatNumber , distanceToNowStrict } from '../../i18n'
8
8
import session from '../../session'
9
9
import { PongMessage , CorrespondenceSeek } from '../../lichess/interfaces'
10
10
import spinner from '../../spinner'
@@ -55,7 +55,8 @@ function offline(ctrl: HomeCtrl) {
55
55
}
56
56
57
57
function online ( ctrl : HomeCtrl ) {
58
- const playbanEndsAt = session . currentBan ( )
58
+ const playban = session . get ( ) ?. playban
59
+ const playbanEndsAt = playban && new Date ( playban . date + playban . mins * 60000 )
59
60
60
61
return (
61
62
< div className = "home" >
@@ -350,31 +351,29 @@ function renderTimeline(ctrl: HomeCtrl) {
350
351
}
351
352
352
353
function renderPlayban ( endsAt : Date ) {
353
- const seconds = ( endsAt . valueOf ( ) - Date . now ( ) ) / 1000
354
354
return (
355
355
< div className = "home-playbanInfo" >
356
- < h2 > Sorry :( </ h2 >
357
- < p > We had to time you out for a { seconds < 3600 ? 'little ' : '' } while. </ p >
356
+ < h2 > { i18n ( 'sorry' ) } </ h2 >
357
+ < p > { i18n ( 'weHadToTimeYouOutForAWhile' ) } </ p >
358
358
< br />
359
- < p > The timeout expires < strong > { fromNow ( endsAt ) } </ strong > . </ p >
360
- < h2 > Why? </ h2 >
359
+ < p > { h . trust ( i18n ( 'timeoutExpires' , ` <strong>${ distanceToNowStrict ( endsAt ) } </strong>` ) ) } </ p >
360
+ < h2 > { i18n ( 'why' ) } </ h2 >
361
361
< p >
362
- We aim to provide a pleasant chess experience for everyone.
363
- To that effect, we must ensure that all players follow good practices.
364
- When a potential problem is detected, we display this message.
362
+ { i18n ( 'pleasantChessExperience' ) } < br />
363
+ { i18n ( 'goodPractice' ) } < br />
364
+ { i18n ( 'potentialProblem' ) }
365
365
</ p >
366
- < h2 > How to avoid this? </ h2 >
366
+ < h2 > { i18n ( 'howToAvoidThis' ) } </ h2 >
367
367
< ul >
368
- < li > Play every game you start </ li >
369
- < li > Try to win (or at least draw) every game you play </ li >
370
- < li > Resign lost games (don't let the clock run down) </ li >
368
+ < li > { i18n ( 'playEveryGame' ) } </ li >
369
+ < li > { i18n ( 'tryToWin' ) } </ li >
370
+ < li > { i18n ( 'resignLostGames' ) } </ li >
371
371
</ ul >
372
372
< br />
373
- < br />
374
373
< p >
375
- We apologize for the temporary inconvenience, < br />
376
- and wish you great games on lichess.org. < br />
377
- Thank you for reading!
374
+ { i18n ( 'temporaryInconvenience' ) } < br />
375
+ { i18n ( 'wishYouGreatGames' ) } < br />
376
+ { i18n ( 'thankYouForReading' ) }
378
377
</ p >
379
378
</ div >
380
379
)
0 commit comments