import React from 'react' import { useSelector, useDispatch } from 'react-redux' import { setStyle } from '../redux/reducers/styleSlice'; import FreeflowCard from './FreeflowCard'; import Calculations from './admin/Calculations'; const GamesHistory = () => { const dispatch = useDispatch(); const styleState = useSelector(state => state.style); function hideGamesHistoryScreen() { dispatch(setStyle({ ...styleState.style, displayGamesHistoryScreen: false, })) } if (styleState.style.displayGamesHistoryScreen) { return (

hideGamesHistoryScreen()}>⬅ Go Back

These are all the games you've played.

Blackjack Games:

{ styleState.style.gamesHistory.blackjack?.rooms?.map((room, roomIdx) => (
{ room?.playerCards?.map((card, i) => ( ))}

Player {room.displayName} (${parseInt(room.initialBet) + parseInt(room.sideBet)})

Outcome:
{room.outcome}
Side Bet Outcome:
{room.sideBetOutcome}
{ room?.dealerCards?.map((card, i) => ( ))}

Dealer {room.dealerName}

)) }

Roulette Games:

{ styleState.style.gamesHistory.roulette?.games?.map((game, gameIdx) => (
Ball on number: {game?.magicNumber}     Winning bets: {game?.winningBets?.join(", ")}
Players:
{ game?.players?.map((player, i) => (
Player {i+1} ->
{player.name} (${player.betAmount})
Betted on: {player.whichBets.join(", ")}
Outcome: {player.outcome}
)) }
)) }

Poker Games:

{ styleState.style.gamesHistory.poker?.tables?.map(table => (
Pot: {table?.pot}     Winners: {table?.winners?.map(e=>e.displayName)?.join(", ")}
{ table?.cards?.map((card, i) => ( ))}
Players:
{table.players?.map(player => (
Player {player.displayName} (${player.betAmount})
{ player?.cards?.map((card, i) => ( ))}
Hand:
))}
)) }
)} else { return <> } } export default GamesHistory