Changeset 3a783f2 for components/poker/sections
- Timestamp:
- 07/05/22 16:36:24 (2 years ago)
- Branches:
- main
- Children:
- 189cd8f
- Parents:
- b13f93b
- Location:
- components/poker/sections
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
components/poker/sections/Messages.jsx
rb13f93b r3a783f2 17 17 turnMessage = `It\'s ${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName}\'s turn.`; 18 18 19 if (p layerState.pokerGame.table.lastBet> 0) {20 callMessage = `${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName} must at least call $${ playerState.pokerGame.table.lastBet}`;19 if (parseInt(playerState.pokerGame.table.lastBet) > 0) { 20 callMessage = `${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName} must at least call $${Math.min(playerState.player.credits, playerState.pokerGame.table.lastBet)}`; 21 21 } 22 22 } … … 24 24 return ( 25 25 <div className="pokerMessagesContainer"> 26 { playerState.pokerGame.table.started && <p>Round {playerState.pokerGame.table.round}/5{roundMessage}</p> } 26 { playerState.pokerGame.table.started && playerState.pokerGame.table.ended && playerState.pokerGame.table.winners.length === 1 && <p>Game over - {playerState.pokerGame.table.winners[0]?.displayName} won ${playerState.pokerGame.table.winners[0]?.wonAmount} with a {playerState.pokerGame.table.winners[0]?.hand?.hand} combination! Congratulations.</p> } 27 { playerState.pokerGame.table.started && playerState.pokerGame.table.ended && playerState.pokerGame.table.winners.length > 1 && <p>Game over - {playerState.pokerGame.table.winners.map(e=>e.displayName).join(", ")} drew!</p> } 28 { playerState.pokerGame.table.started && playerState.pokerGame.table.ended && <p>New game will start soon.</p> } 29 30 { playerState.pokerGame.table.started && !playerState.pokerGame.table.ended && <p>Round {playerState.pokerGame.table.round}/4{roundMessage}</p> } 27 31 { !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> }32 { playerState.pokerGame.table.started && !playerState.pokerGame.table.ended && <p>{turnMessage}</p> } 33 { playerState.pokerGame.table.started && !playerState.pokerGame.table.ended && <p>{callMessage}</p> } 30 34 </div> 31 35 ) -
components/poker/sections/PlayButtons.jsx
rb13f93b r3a783f2 4 4 5 5 import axios from 'axios'; 6 import { setPoker Game } from '../../../redux/reducers/playerSlice';6 import { setPoker } from '../../../redux/reducers/styleSlice'; 7 7 8 8 const PlayButtons = () => { … … 10 10 11 11 const playerState = useSelector(state => state.player); 12 const styleState = useSelector(state => state.style); 12 13 13 14 function sitDown() { … … 20 21 21 22 const checkClass = playerState.pokerGame.table.lastBet === 0 ? 'secondaryButton' : 'tertiaryButton'; 22 const callClass = 'secondaryButton'23 const callClass = playerState.pokerGame.table.lastBet > 0 ? 'secondaryButton' : 'tertiaryButton' 23 24 const raiseClass = playerState.pokerGame.table.round >= 2 ? 'secondaryButton' : 'tertiaryButton'; 24 25 const foldClass = 'secondaryButton'; … … 33 34 34 35 function raise() { 35 axios.get(`/api/poker?action=game_action&session_id=${localStorage.CAESSINO_SESSION_ID}&specificAction=raise&betAmount=0`); 36 dispatch(setPoker({ 37 ...styleState.poker, 38 displays: { 39 ...styleState.poker.displays, 40 raiseModal: true, 41 }, 42 })) 36 43 } 37 44 … … 40 47 } 41 48 42 if (playerState.pokerGame.table.started && playerState.pokerGame.player.isSatDown ) {49 if (playerState.pokerGame.table.started && playerState.pokerGame.player.isSatDown && parseInt(playerState.pokerGame.table.round) < 5) { 43 50 return ( 44 51 <div className="pokerPlayButtonsContainer">
Note:
See TracChangeset
for help on using the changeset viewer.