main
Last change
on this file since aac3b2b was ace7865, checked in by anastasovv <simon@…>, 2 years ago |
Finished Roulette
|
-
Property mode
set to
100644
|
File size:
2.2 KB
|
Line | |
---|
1 | import React from 'react'
|
---|
2 |
|
---|
3 | import { useSelector } from 'react-redux'
|
---|
4 |
|
---|
5 | const PlayersDisplay = () => {
|
---|
6 | const playerState = useSelector(state => state.player);
|
---|
7 | const styleState = useSelector(state => state.style);
|
---|
8 |
|
---|
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>
|
---|
27 | </div>
|
---|
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>
|
---|
48 | </div>
|
---|
49 | )
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | export default PlayersDisplay |
---|
Note:
See
TracBrowser
for help on using the repository browser.