Changeset ace7865 for components/roulette/PlayersDisplay.jsx
- Timestamp:
- 06/25/22 11:30:19 (2 years ago)
- Branches:
- main
- Children:
- b13f93b
- Parents:
- 9bd09b0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
components/roulette/PlayersDisplay.jsx
r9bd09b0 race7865 5 5 const PlayersDisplay = () => { 6 6 const playerState = useSelector(state => state.player); 7 const styleState = useSelector(state => state.style); 7 8 8 return ( 9 <div className="roulettePlayersContainer"> 10 <div> 11 <p>Online:</p> 12 <hr/> 13 {playerState.rouletteGame?.players.map((player, i) => ( 14 player.status.substr(1, 1) === '1' ? <p key={player + i}>{player.name}</p> : <span key={player + i}></span> 15 ))} 9 // See results. 10 if (playerState.rouletteGame.timeToStart > styleState.roulette.COUNTDOWN_FROM) { 11 return ( 12 <div className="roulettePlayersContainer"> 13 <div> 14 <p>Winners:</p> 15 <hr/> 16 {playerState.rouletteGame?.players.map((player, i) => ( 17 player.betAmount > 0 && player.outcome === 'won' ? <p key={player + i}>{player.name} <span style={{color: '#ead24d'}}>[{player.whichBets.toString()}]</span></p> : <span key={player + i}></span> 18 ))} 19 </div> 20 <div> 21 <p>Losers:</p> 22 <hr/> 23 {playerState.rouletteGame?.players.map((player, i) => ( 24 player.betAmount > 0 && player.outcome === 'lost' ? <p key={player + i}>{player.name} <span style={{color: '#ead24d'}}>[{player.whichBets.toString()}]</span></p> : <span key={player + i}></span> 25 ))} 26 </div> 16 27 </div> 17 <div> 18 <p>Betted:</p> 19 <hr/> 20 {playerState.rouletteGame?.players.map((player, i) => ( 21 player.status.substr(1, 1) === '2' ? <p key={player + i}>{player.name} <span style={{color: '#ead24d'}}>[{player.whichBets.toString()}]</span> ${player.betAmount}</p> : <span key={player + i}></span> 22 ))} 28 ) 29 } 30 // See who betted. 31 else { 32 return ( 33 <div className="roulettePlayersContainer"> 34 <div> 35 <p>Online:</p> 36 <hr/> 37 {playerState.rouletteGame?.players.map((player, i) => ( 38 player.status.substr(1, 1) === '1' ? <p key={player + i}>{player.name}</p> : <span key={player + i}></span> 39 ))} 40 </div> 41 <div> 42 <p>Betted:</p> 43 <hr/> 44 {playerState.rouletteGame?.players.map((player, i) => ( 45 player.status.substr(1, 1) === '2' ? <p key={player + i}>{player.name} <span style={{color: '#ead24d'}}>[{player.whichBets.toString()}]</span></p> : <span key={player + i}></span> 46 ))} 47 </div> 23 48 </div> 24 </div>25 )49 ) 50 } 26 51 } 27 52
Note:
See TracChangeset
for help on using the changeset viewer.