main
Last change
on this file since faff334 was 433e0c5, checked in by anastasovv <simon@…>, 2 years ago |
Added complaints, managing credits, and lost connection screens
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[9bd09b0] | 1 | import React from 'react'
|
---|
| 2 |
|
---|
[433e0c5] | 3 | import { useSelector } from 'react-redux'
|
---|
[9bd09b0] | 4 |
|
---|
| 5 | const Timer = () => {
|
---|
| 6 | const playerState = useSelector(state => state.player);
|
---|
| 7 |
|
---|
[ace7865] | 8 | function getTimer() {
|
---|
[d0ef259] | 9 | const timer = playerState.rouletteGame.game.timeToStart;
|
---|
[9bd09b0] | 10 |
|
---|
[d0ef259] | 11 | const timeString = (timer < 0 || timer > playerState.rouletteGame.game.COUNTDOWN_FROM - 2) ? '00:00' : '0' + parseInt(timer/60) + ':' + (timer%60 < 10 ? '0' : '') + (timer%60);
|
---|
[9bd09b0] | 12 |
|
---|
| 13 | return timeString;
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | return (
|
---|
| 17 | <div className="rouletteTimer">
|
---|
[d0ef259] | 18 | {playerState.rouletteGame.game.timeToStart > 0 && playerState.rouletteGame.game.timeToStart <= playerState.rouletteGame.game.COUNTDOWN_FROM - 2 && <span style={{fontSize: '1rem'}}>Wheel will spin in:</span>}
|
---|
[ace7865] | 19 |
|
---|
| 20 | <span>{getTimer()}</span>
|
---|
| 21 |
|
---|
[d0ef259] | 22 | {playerState.rouletteGame.game.timeToStart > 10 && playerState.rouletteGame.game.timeToStart <= playerState.rouletteGame.game.COUNTDOWN_FROM - 2 && <span style={{fontSize: '1rem'}}>Make your bets.</span>}
|
---|
[ace7865] | 23 |
|
---|
[d0ef259] | 24 | {playerState.rouletteGame.game.timeToStart <= 10 && <span style={{fontSize: '1rem'}}>Betting time is over.</span>}
|
---|
[ace7865] | 25 |
|
---|
[d0ef259] | 26 | {playerState.rouletteGame.game.timeToStart > playerState.rouletteGame.game.COUNTDOWN_FROM && <span style={{fontSize: '1rem'}}>Time to see who won :)</span>}
|
---|
| 27 | {playerState.rouletteGame.game.timeToStart > playerState.rouletteGame.game.COUNTDOWN_FROM && <span style={{fontSize: '.7rem'}}>(And prepare, you can bet again soon.)</span>}
|
---|
[9bd09b0] | 28 | </div>
|
---|
| 29 | )
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | export default Timer |
---|
Note:
See
TracBrowser
for help on using the repository browser.