Changeset 189cd8f for components


Ignore:
Timestamp:
07/06/22 00:11:47 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
aac3b2b
Parents:
3a783f2
Message:

Code cleanings

Location:
components
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • components/Notification.jsx

    r3a783f2 r189cd8f  
    22
    33import { AiOutlineClose } from 'react-icons/ai';
     4
     5import { useState } from 'react';
    46
    57import { useDispatch, useSelector } from 'react-redux';
     
    79
    810const Notification = () => {
     11    const [timeoutIsSet, setTimeoutIsSet] = useState(false);
     12
    913    const styleState = useSelector(state => state.style);
    1014
     
    2428    }
    2529
    26     if (styleState.style.notification.show === true) {
     30    if (styleState.style.notification.show === true && !timeoutIsSet) {
     31        setTimeoutIsSet(true);
    2732        setTimeout(() => {
    2833            close();
     34            setTimeoutIsSet(false);
    2935        }, 3000);
    3036    }
  • components/poker/PokerHeader.jsx

    r3a783f2 r189cd8f  
    3030        }));
    3131
    32         let interval;
     32        let interval = null;
    3333
    3434        axios.get(`/api/poker?action=get_player_info_on_enter&session_id=${localStorage.CAESSINO_SESSION_ID}`).then(res => {
    3535            if (res.data?.success) {
     36                if (interval !== null) clearInterval(interval);
     37
    3638                dispatch(setPlayer({
    3739                    ...playerState.player,
     
    8991                    </h2>
    9092                </Link>
    91                 { playerState.pokerGame.player.table.length > 0 && <button style={{marginBottom: '4px', marginLeft: '32px', fontSize: '16px'}} className="tertiaryButton" onClick={() => leaveTable()}>Leave Table</button> }
     93                { playerState.pokerGame?.player?.table?.length > 0 && <button style={{marginBottom: '4px', marginLeft: '32px', fontSize: '16px'}} className="tertiaryButton" onClick={() => leaveTable()}>Leave Table</button> }
    9294            </div>
    9395            <nav>
  • components/poker/PokerSections.jsx

    r3a783f2 r189cd8f  
    1515  const playerState = useSelector(state => state.player);
    1616
    17   if (playerState.pokerGame.player.table.length > 0) {
     17  if (playerState.pokerGame?.player?.table?.length > 0) {
    1818    return (
    1919      <>
Note: See TracChangeset for help on using the changeset viewer.