Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SENTHILnew committed Feb 6, 2024
1 parent a1499a5 commit d60cc9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/components/Poker/GameController/GameController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import LinkIcon from '@material-ui/icons/Link';
import VisibilityIcon from '@material-ui/icons/Visibility';
import DeleteOutlined from '@material-ui/icons/DeleteForeverTwoTone';
import Alert from '@material-ui/lab/Alert';
import React, { useState } from 'react';
import React, { useCallback, useState } from 'react';
import { useHistory } from 'react-router-dom';
import { finishGame, resetGame, removeGame } from '../../../service/games';
import { Game, GameType } from '../../../types/game';
Expand Down Expand Up @@ -58,6 +58,10 @@ export const GameController: React.FC<GameControllerProps> = ({ game, currentPla
window.location.href = '/';
};

const onTimerEndCallBack = useCallback(()=>{
finishGame(game.id);
},[game.id])

return (
<Grow in={true} timeout={2000}>
<div className='GameController'>
Expand All @@ -74,9 +78,7 @@ export const GameController: React.FC<GameControllerProps> = ({ game, currentPla
<TimerProgress
timerValue={timerValue ?? 0}
startTimer={isTimmerRunnig}
onTimerEnd={() => {
finishGame(game.id);
}}
onTimerEnd={onTimerEndCallBack}
></TimerProgress>
) : null}
{game.gameType !== GameType.TShirt &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const TimerProgress: React.FC<TimerProgressProps> = ({
return () => {
if (timer) clearInterval(timer);
};
}, [startTimer]);
}, [startTimer,onTimerEnd,milliseconds]);

useEffect(() => {
setProgress(timerValue * 1000);
Expand Down

0 comments on commit d60cc9b

Please sign in to comment.