import React from 'react'
import { useSelector } from 'react-redux'
const Timer = () => {
const playerState = useSelector(state => state.player);
function getTimer() {
const timer = playerState.rouletteGame.game.timeToStart;
const timeString = (timer < 0 || timer > playerState.rouletteGame.game.COUNTDOWN_FROM - 2) ? '00:00' : '0' + parseInt(timer/60) + ':' + (timer%60 < 10 ? '0' : '') + (timer%60);
return timeString;
}
return (
{playerState.rouletteGame.game.timeToStart > 0 && playerState.rouletteGame.game.timeToStart <= playerState.rouletteGame.game.COUNTDOWN_FROM - 2 && Wheel will spin in:}
{getTimer()}
{playerState.rouletteGame.game.timeToStart > 10 && playerState.rouletteGame.game.timeToStart <= playerState.rouletteGame.game.COUNTDOWN_FROM - 2 && Make your bets.}
{playerState.rouletteGame.game.timeToStart <= 10 && Betting time is over.}
{playerState.rouletteGame.game.timeToStart > playerState.rouletteGame.game.COUNTDOWN_FROM && Time to see who won :)}
{playerState.rouletteGame.game.timeToStart > playerState.rouletteGame.game.COUNTDOWN_FROM && (And prepare, you can bet again soon.)}
)
}
export default Timer