import React from 'react' import { useSelector } from 'react-redux' const Messages = () => { const playerState = useSelector(state => state.player); const styleState = useSelector(state => state.style); let roundMessage = ''; if (playerState.pokerGame.table.round === 1) { roundMessage = ' - Everyone must call $20 before cards are dealt.'; } let turnMessage = ''; let callMessage = ''; if (playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx] !== undefined) { turnMessage = `It\'s ${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName}\'s turn.`; if (playerState.pokerGame.table.lastBet > 0) { callMessage = `${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName} must at least call $${playerState.pokerGame.table.lastBet}`; } } return (
{ playerState.pokerGame.table.started &&

Round {playerState.pokerGame.table.round}/5{roundMessage}

} { !playerState.pokerGame.table.started &&

Waiting for coordinator {playerState.pokerGame.table.creator} to start the game.

} { playerState.pokerGame.table.started &&

{turnMessage}

} { playerState.pokerGame.table.started &&

{callMessage}

}
) } export default Messages