source: components/poker/sections/Messages.jsx@ b13f93b

main
Last change on this file since b13f93b was b13f93b, checked in by anastasovv <simon@…>, 2 years ago

Made poker tables system and round 1

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[b13f93b]1import React from 'react'
2
3import { useSelector } from 'react-redux'
4
5const Messages = () => {
6 const playerState = useSelector(state => state.player);
7 const styleState = useSelector(state => state.style);
8
9 let roundMessage = '';
10 if (playerState.pokerGame.table.round === 1) {
11 roundMessage = ' - Everyone must call $20 before cards are dealt.';
12 }
13
14 let turnMessage = '';
15 let callMessage = '';
16 if (playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx] !== undefined) {
17 turnMessage = `It\'s ${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName}\'s turn.`;
18
19 if (playerState.pokerGame.table.lastBet > 0) {
20 callMessage = `${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName} must at least call $${playerState.pokerGame.table.lastBet}`;
21 }
22 }
23
24 return (
25 <div className="pokerMessagesContainer">
26 { playerState.pokerGame.table.started && <p>Round {playerState.pokerGame.table.round}/5{roundMessage}</p> }
27 { !playerState.pokerGame.table.started && <p>Waiting for coordinator {playerState.pokerGame.table.creator} to start the game.</p> }
28 { playerState.pokerGame.table.started && <p>{turnMessage}</p> }
29 { playerState.pokerGame.table.started && <p>{callMessage}</p> }
30 </div>
31 )
32}
33
34export default Messages
Note: See TracBrowser for help on using the repository browser.