Changeset 433e0c5 for components/poker


Ignore:
Timestamp:
07/15/22 14:45:30 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
55701f0
Parents:
1df3fde
Message:

Added complaints, managing credits, and lost connection screens

Location:
components/poker
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • components/poker/Poker.jsx

    r1df3fde r433e0c5  
    88import Notification from '../Notification'
    99import PokerSections from './PokerSections'
     10import LostConnection from '../LostConnection'
    1011
    1112const Poker = () => {
     
    2526
    2627      <Notification/>
     28
     29      <LostConnection/>
    2730    </div>
    2831  )
  • components/poker/PokerHeader.jsx

    r1df3fde r433e0c5  
    1010import { useDispatch, useSelector } from 'react-redux'
    1111
    12 import { setPlayer, setPokerGame, setSocket } from '../../redux/reducers/playerSlice'
     12import { setPlayer, setPokerGame } from '../../redux/reducers/playerSlice'
    1313import { setStyle } from '../../redux/reducers/styleSlice'
    1414
     
    3636                if (interval !== null) clearInterval(interval);
    3737
    38                 dispatch(setPlayer({
    39                     ...playerState.player,
    40                     displayName: res.data?.displayName,
    41                     session_id: res.data?.session_id,
    42                     credits: res.data?.credits,
    43                 }));
    44 
    45                 dispatch(setStyle({
    46                     ...styleState.style,
    47                     displayLoadingScreen: false,
    48                 }))
    49 
    5038                interval = setInterval(() => {
    5139                    axios.get(`/api/poker?action=update_state&session_id=${localStorage.CAESSINO_SESSION_ID}`).then(newRes => {
     
    5644                                dispatch(setPlayer({
    5745                                    ...playerState.player,
     46                                    displayName: res.data?.displayName,
     47                                    session_id: res.data?.session_id,
    5848                                    credits: newRes.data?.pokerGame?.player?.credits,
    5949                                }))
    6050                            }
    6151                        }
     52
     53                        dispatch(setStyle({
     54                            ...styleState.style,
     55                            displayLoadingScreen: false,
     56                            notification: {
     57                                ...styleState.style.notification,
     58                                show: false,
     59                            },
     60                            lostConnectionInfo: {
     61                                show: false,
     62                                message: ''
     63                            }
     64                        }))
     65                    }).catch(error => {
     66                        dispatch(setStyle({
     67                            ...styleState.style,
     68                            displayLoadingScreen: false,
     69                            lostConnectionInfo: {
     70                                show: true,
     71                                message: 'Game will be played until the end upon server gets live. You cannot continue your game, but the money earned / lost will be updated.'
     72                            }
     73                        }))
    6274                    });
    63                 }, 2000);
     75                }, 1000);
    6476            }
    6577            else {
  • components/poker/PokerSections.jsx

    r1df3fde r433e0c5  
    11import React from 'react'
    22
    3 import Cards from './sections/Cards'
    43import CardsInTheMiddle from './sections/CardsInTheMiddle'
    54import Chairs from './sections/Chairs'
     
    87import PickATable from './sections/PickATable'
    98
    10 import { useSelector, useDispatch } from 'react-redux'
     9import { useSelector } from 'react-redux'
    1110import Pot from './sections/Pot'
    1211import RaiseModal from './sections/RaiseModal'
     
    2120
    2221          <Chairs/>
    23 
    24           <Cards/>
    2522
    2623          <CardsInTheMiddle/>
  • components/poker/sections/PickATable.jsx

    r1df3fde r433e0c5  
    66
    77import axios from 'axios';
    8 import { setPokerGame } from '../../../redux/reducers/playerSlice';
    98
    109const PickATable = () => {
Note: See TracChangeset for help on using the changeset viewer.