main
Last change
on this file since 433e0c5 was d0ef259, checked in by anastasovv <simon@…>, 2 years ago |
Roulette rethought with 1 second update calls
|
-
Property mode
set to
100644
|
File size:
2.1 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 |
|
---|
8 | // See results.
|
---|
9 | if (playerState.rouletteGame.game.timeToStart > playerState.rouletteGame.game.COUNTDOWN_FROM) {
|
---|
10 | return (
|
---|
11 | <div className="roulettePlayersContainer">
|
---|
12 | <div>
|
---|
13 | <p>Winners:</p>
|
---|
14 | <hr/>
|
---|
15 | {playerState.rouletteGame?.game.players.map((player, i) => (
|
---|
16 | 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>
|
---|
17 | ))}
|
---|
18 | </div>
|
---|
19 | <div>
|
---|
20 | <p>Losers:</p>
|
---|
21 | <hr/>
|
---|
22 | {playerState.rouletteGame?.game.players.map((player, i) => (
|
---|
23 | 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>
|
---|
24 | ))}
|
---|
25 | </div>
|
---|
26 | </div>
|
---|
27 | )
|
---|
28 | }
|
---|
29 | // See who betted.
|
---|
30 | else {
|
---|
31 | return (
|
---|
32 | <div className="roulettePlayersContainer">
|
---|
33 | <div>
|
---|
34 | <p>Online:</p>
|
---|
35 | <hr/>
|
---|
36 | {playerState.rouletteGame?.game.players.map((player, i) => (
|
---|
37 | player.status.substr(1, 1) === '1' ? <p key={player + i}>{player.name}</p> : <span key={player + i}></span>
|
---|
38 | ))}
|
---|
39 | </div>
|
---|
40 | <div>
|
---|
41 | <p>Betted:</p>
|
---|
42 | <hr/>
|
---|
43 | {playerState.rouletteGame?.game.players.map((player, i) => (
|
---|
44 | 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>
|
---|
45 | ))}
|
---|
46 | </div>
|
---|
47 | </div>
|
---|
48 | )
|
---|
49 | }
|
---|
50 | }
|
---|
51 |
|
---|
52 | export default PlayersDisplay |
---|
Note:
See
TracBrowser
for help on using the repository browser.