source: components/roulette/Timer.jsx@ 433e0c5

main
Last change on this file since 433e0c5 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
Line 
1import React from 'react'
2
3import { useSelector } from 'react-redux'
4
5const Timer = () => {
6 const playerState = useSelector(state => state.player);
7
8 function getTimer() {
9 const timer = playerState.rouletteGame.game.timeToStart;
10
11 const timeString = (timer < 0 || timer > playerState.rouletteGame.game.COUNTDOWN_FROM - 2) ? '00:00' : '0' + parseInt(timer/60) + ':' + (timer%60 < 10 ? '0' : '') + (timer%60);
12
13 return timeString;
14 }
15
16 return (
17 <div className="rouletteTimer">
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>}
19
20 <span>{getTimer()}</span>
21
22 {playerState.rouletteGame.game.timeToStart > 10 && playerState.rouletteGame.game.timeToStart <= playerState.rouletteGame.game.COUNTDOWN_FROM - 2 && <span style={{fontSize: '1rem'}}>Make your bets.</span>}
23
24 {playerState.rouletteGame.game.timeToStart <= 10 && <span style={{fontSize: '1rem'}}>Betting time is over.</span>}
25
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>}
28 </div>
29 )
30}
31
32export default Timer
Note: See TracBrowser for help on using the repository browser.