import React from 'react' import { useSelector, useDispatch } from 'react-redux' import { setStyle } from '../redux/reducers/styleSlice'; import { AiOutlineClose } from 'react-icons/ai'; import axios from 'axios'; const Stats = () => { const styleState = useSelector(state => state.style); const dispatch = useDispatch(); function close() { dispatch(setStyle({ ...styleState.style, displayStatsScreen: false, })) } function openHistory() { axios.get(`/api/postgre?action=get_games_history&session_id=${localStorage.CAESSINO_SESSION_ID}`).then(res => { if (res.data?.success) { dispatch(setStyle({ ...styleState.style, gamesHistory: { blackjack: { rooms: res.data?.blackjack, }, roulette: { games: res.data?.roulette, }, poker: { tables: res.data?.poker, }, }, displayGamesHistoryScreen: true, })) } }) } return (
close()} style={{position: 'absolute', top: '20px', right: '20px'}}/>

Stats:

Total money won: ${styleState.style.statsScreenInfo.money.earned}

Total blackjack games won: {styleState.style.statsScreenInfo.blackjack.wins}

Total roulette games won: {styleState.style.statsScreenInfo.roulette.wins}

Total poker games won: {styleState.style.statsScreenInfo.poker.wins}

) } export default Stats