Changeset 22367db for components
- Timestamp:
- 07/19/22 19:38:51 (2 years ago)
- Branches:
- main
- Children:
- 41d3f60
- Parents:
- faff334
- Location:
- components
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
components/GamesHistory.jsx
rfaff334 r22367db 39 39 <h5><Calculations action="calculateHandValue" cards={room.playerCards}/></h5> 40 40 </div> 41 <p>Player {room .displayName} (${parseInt(room.initialBet) + parseInt(room.sideBet)})</p>41 <p>Player {room?.displayName} (${parseInt(room.initialBet) + parseInt(room.sideBet)})</p> 42 42 </div> 43 43 <div> 44 44 <div> 45 <h6><span>Outcome:</span><br/>{room.outcome}</h6> 46 <h6><span>Side Bet Outcome:</span><br/>{room.sideBetOutcome}</h6> 45 <h6><span>Played on:<br/>{room.finished}</span></h6> 46 { room?.outcome?.lenght > 0 && <h6><span>Outcome:</span><br/>{room.outcome}</h6> } 47 { room?.sideBetOutcome.lenght > 0 && <h6><span>Side Bet Outcome:</span><br/>{room.sideBetOutcome}</h6> } 47 48 </div> 48 49 </div> … … 65 66 <div key={`roulettegame${gameIdx}`}> 66 67 <h6> 68 <span>Played on: {game?.finished}</span><br/> 67 69 <span>Ball on number: </span>{game?.magicNumber} 68 70 <span>Winning bets: </span>{game?.winningBets?.join(", ")} … … 75 77 </div> 76 78 <div> 77 <h6><span>{player.name} ( ${player.betAmount})</span></h6>79 <h6><span>{player.name} (</span>${player.betAmount}<span>)</span></h6> 78 80 </div> 79 81 <div> … … 81 83 </div> 82 84 <div> 83 <h6><span>Outcome: {player.outcome}</span></h6>85 <h6><span>Outcome: </span>{player.outcome}</h6> 84 86 </div> 85 87 </div> … … 94 96 <div key={table.id} className="livePokerGame"> 95 97 <h6> 96 <span>Pot: </span>{table?.pot} 97 <span>Winners: </span>{table?.winners?.map(e=>e.displayName)?.join(", ")} 98 <span>Played on: {table?.finished}</span><br/> 99 <span>Pot: </span>${table?.pot} 100 <span>Winners: </span>{table?.winners?.map(e=>e?.displayName)?.join(", ")} 98 101 </h6> 99 102 <div className="cardsOnTable" style={{marginTop: '2rem'}}> … … 106 109 <div key={player.id} className="playerInLivePokerGame"> 107 110 <div> 108 <h6><span>Player {player .displayName} (${player.betAmount})</span></h6>111 <h6><span>Player {player?.displayName} (</span>${player.betAmount}<span>)</span></h6> 109 112 </div> 110 113 <div className="cards"> -
components/Header.jsx
rfaff334 r22367db 11 11 import axios from 'axios'; 12 12 13 import { signOut, useSession } from 'next-auth/react'; 14 13 15 const Header = () => { 16 const { data: googleSession } = useSession(); 17 18 useEffect(() => { 19 if (googleSession && (!localStorage.CAESSINO_SESSION_ID || localStorage.CAESSINO_SESSION_ID === "")) { 20 axios.post(`/api/postgre`, { 21 action: 'login_via_google', 22 googleSession: googleSession, 23 }) 24 .then(res => { 25 if (res.data?.success) { 26 localStorage.CAESSINO_SESSION_ID = res.data?.session?.id; 27 28 dispatch(setPlayer({ 29 ...playerState.player, 30 username: res.data?.session?.username, 31 displayName: res.data?.session?.displayName, 32 credits: res.data?.session.credits, 33 session_id: res.data?.session?.id, 34 })); 35 36 dispatch(setStyle({ 37 ...styleState.style, 38 displayLoadingScreen: false, 39 displayLoginScreen: false, 40 loginScreenInfo: { 41 username: '', 42 password: '', 43 }, 44 notification: { 45 show: true, 46 text: 'Successfully logged in.', 47 status: 'success', 48 }, 49 inlineAlertText: '', 50 })); 51 } 52 }); 53 } 54 }, [googleSession]) 55 56 14 57 const dispatch = useDispatch(); 15 58 … … 50 93 credits: 0, 51 94 })) 95 signOut(); 52 96 } 53 97 }) -
components/LoginScreen.jsx
rfaff334 r22367db 7 7 import { setPlayer } from '../redux/reducers/playerSlice'; 8 8 import { setStyle } from '../redux/reducers/styleSlice'; 9 10 import { FcGoogle } from 'react-icons/fc'; 11 import { signIn } from 'next-auth/react'; 9 12 10 13 import axios from 'axios'; … … 146 149 <button className="secondaryButton" onClick={() => login()}>Log In</button> 147 150 </div> 151 <button onClick={() => signIn()} className="primaryButton" style={{marginTop: '10rem', color: '#eee', padding: '.6rem 2rem'}}><FcGoogle style={{padding: '.2rem', background: '#eee', borderRadius: '50%', fontSize: '2rem', marginBottom: '-.4rem'}}/> Log In With Google</button> 148 152 </div> 149 153 </div> -
components/admin/LiveGames.jsx
rfaff334 r22367db 71 71 <h5><Calculations action="calculateHandValue" cards={room.playerCards}/></h5> 72 72 </div> 73 <p>Player {room .displayName} (${parseInt(room.initialBet) + parseInt(room.sideBet)})</p>73 <p>Player {room?.displayName} (${parseInt(room.initialBet) + parseInt(room.sideBet)})</p> 74 74 </div> 75 75 <div> 76 76 <div> 77 77 <h6><span>Status:</span><br/>{room.status}</h6> 78 <h6><span>Outcome:</span><br/>{room.outcome}</h6>79 <h6><span>Side Bet Outcome:</span><br/>{room.sideBetOutcome}</h6>78 { room?.outcome?.length > 0 && <h6><span>Outcome:</span><br/>{room.outcome}</h6> } 79 { room?.sideBetOutcome?.length > 0 && <h6><span>Side Bet Outcome:</span><br/>{room.sideBetOutcome}</h6> } 80 80 </div> 81 81 </div> … … 99 99 <span>Status: </span>{adminInformationState.adminInformation?.liveGames?.roulette?.status} 100 100 <span>Time to start: </span>{adminInformationState.adminInformation?.liveGames?.roulette?.timeToStart} 101 <span>Ball on number: </span>{adminInformationState.adminInformation?.liveGames?.roulette?.magicNumber} 102 <span>Winning bets: </span>{adminInformationState.adminInformation?.liveGames?.roulette?.winningBets?.join(", ")}101 { adminInformationState.adminInformation?.liveGames?.roulette?.magicNumber != -1 && <><span>Ball on number: </span>{adminInformationState.adminInformation?.liveGames?.roulette?.magicNumber} </> } 102 { adminInformationState.adminInformation?.liveGames?.roulette?.magicNumber != -1 && <><span>Winning bets: </span>{adminInformationState.adminInformation?.liveGames?.roulette?.winningBets?.join(", ")}</> } 103 103 </h6> 104 104 <h6 style={{marginTop: '2rem'}}><span>Players:</span></h6> … … 109 109 </div> 110 110 <div> 111 <h6><span>{player.name} (${player .betAmount})</span></h6>111 <h6><span>{player.name} (${player?.betAmount})</span></h6> 112 112 </div> 113 113 <div> 114 <h6><span>Betted on: </span>{player.whichBets.join(", ")}</h6>114 { player?.whichBets?.length > 0 && <h6><span>Betted on: </span>{player?.whichBets?.join(", ")}</h6> } 115 115 </div> 116 116 <div> 117 <h6><span>Outcome: {player.outcome}</span></h6>117 { adminInformationState.adminInformation?.liveGames?.roulette?.magicNumber != -1 && player?.whichBets?.length > 0 && <h6><span>Outcome: </span>{player.outcome}</h6> } 118 118 </div> 119 119 </div> … … 129 129 <span>Round: </span>{table?.round}/4 130 130 <span>Started: </span>{table?.started} 131 <span>Player on turn: </span>{table ?.turnIdx} 132 <span>Pot: </span> {table?.pot} 133 <span>Winners: </span>{table?.winners?.map(e=>e.displayName)?.join(", ")}131 <span>Player on turn: </span>{table.players[table.turnIdx]?.displayName ?? '-'} 132 <span>Pot: </span>${table?.pot} 133 { table?.winners?.length > 0 && <><span>Winners: </span>{table?.winners?.map(e=>e?.displayName)?.join(", ")}</> } 134 134 </h6> 135 135 <div className="cardsOnTable" style={{marginTop: '2rem'}}> … … 142 142 <div key={player.id} className="playerInLivePokerGame"> 143 143 <div> 144 <h6><span>Player {player .displayName} (${player.betAmount})</span></h6>144 <h6><span>Player {player?.displayName} (${player.betAmount})</span></h6> 145 145 </div> 146 146 <div className="cards"> … … 150 150 </div> 151 151 <div> 152 <h6><span>Hand: </span><Calculations action="getBestHandDetails" cards={player.cards} cards2={table.cards}/></h6>152 { table?.cards?.length > 0 && <h6><span>Hand: </span><Calculations action="getBestHandDetails" cards={player.cards} cards2={table.cards}/></h6> } 153 153 </div> 154 154 </div> -
components/blackjack/BlackjackHeader.jsx
rfaff334 r22367db 1 /* eslint-disable @next/next/no-html-link-for-pages */ 1 2 import React from 'react' 2 3 … … 62 63 dispatch(setBlackjackGame(newRes.data?.blackjackGame)) 63 64 64 if (newRes.data?.blackjackGame?.credits !== playerState.player.credits && parseInt(newRes.data?.blackjackGame?.credits) > 0) {65 if (newRes.data?.blackjackGame?.credits !== playerState.player.credits && parseInt(newRes.data?.blackjackGame?.credits) >= 0) { 65 66 dispatch(setPlayer({ 66 67 ...playerState.player, … … 138 139 return ( 139 140 <header className="header"> 140 < Link href="/" passHref>141 <a href="/"> 141 142 <h2> 142 143 <AiOutlineArrowLeft /> 143 144 </h2> 144 </ Link>145 </a> 145 146 <nav> 146 147 <ul> -
components/poker/PokerHeader.jsx
rfaff334 r22367db 1 /* eslint-disable @next/next/no-html-link-for-pages */ 1 2 import React from 'react' 2 3 … … 49 50 dispatch(setPokerGame(newRes.data?.pokerGame)) 50 51 51 if (newRes.data?.pokerGame?.player?.credits !== playerState.player.credits && newRes.data?.pokerGame?.player?.credits > 0) {52 if (newRes.data?.pokerGame?.player?.credits !== playerState.player.credits && newRes.data?.pokerGame?.player?.credits >= 0) { 52 53 dispatch(setPlayer({ 53 54 ...playerState.player, … … 110 111 <header className="header"> 111 112 <div style={{display: 'flex', alignItems: 'center'}}> 112 < Link href="/" passHref>113 <a href="/"> 113 114 <h2> 114 115 <AiOutlineArrowLeft /> 115 116 </h2> 116 </ Link>117 </a> 117 118 { playerState.pokerGame?.player?.table?.length > 0 && <button style={{marginBottom: '4px', marginLeft: '32px', fontSize: '16px'}} className="tertiaryButton" onClick={() => leaveTable()}>Leave Table</button> } 118 119 </div> -
components/roulette/RouletteHeader.jsx
rfaff334 r22367db 1 /* eslint-disable @next/next/no-html-link-for-pages */ 1 2 import React from 'react' 2 3 … … 76 77 } 77 78 78 if (newRes.data?.rouletteGame?.player?.credits !== playerState.player.credits && newRes.data?.rouletteGame?.player?.credits > 0) {79 if (newRes.data?.rouletteGame?.player?.credits !== playerState.player.credits && newRes.data?.rouletteGame?.player?.credits >= 0) { 79 80 dispatch(setPlayer({ 80 81 ...playerState.player, … … 146 147 return ( 147 148 <header className="header"> 148 < Link href="/" passHref>149 <a href="/"> 149 150 <h2> 150 151 <AiOutlineArrowLeft /> 151 152 </h2> 152 </ Link>153 </a> 153 154 <nav> 154 155 <ul>
Note:
See TracChangeset
for help on using the changeset viewer.