From bee36052f2c9cda54d41e0bb45dbe0aec6d8b91f Mon Sep 17 00:00:00 2001 From: Mikael Lindlof Date: Sun, 6 Dec 2020 01:19:02 +0000 Subject: [PATCH] Cancel game progress spinner --- web/src/App.tsx | 15 +-------------- web/src/GamePlaying.tsx | 11 ++++++++--- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index bb71049..e0582d9 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -45,7 +45,7 @@ export const App: React.FC = () => { playHandsign(client, game, handsign, setGame, enqueueSnackbar) } leaveGame={() => setGame(undefined)} - claimInactivity={() => claimInactivity(client, game, setGame, enqueueSnackbar)} + claimInactivity={async () => setGame(await Game.claimInactivity(client, game))} enqueueSnackbar={enqueueSnackbar} /> @@ -137,17 +137,4 @@ const playHandsign = async ( } }; -const claimInactivity = async ( - client: SecretJS.SigningCosmWasmClient, - game: Game.Game, - setGame: Function, - enqueueSnackbar: Function, -): Promise => { - try { - setGame(await Game.claimInactivity(client, game)); - } catch (error) { - enqueueSnackbar('Secret error', { variant: 'error' }); - } -}; - export default App; diff --git a/web/src/GamePlaying.tsx b/web/src/GamePlaying.tsx index edee739..a6fe801 100644 --- a/web/src/GamePlaying.tsx +++ b/web/src/GamePlaying.tsx @@ -70,6 +70,7 @@ export default (props: Props) => { try { await claimInactivity(); } catch { + enqueueSnackbar('Secret error', { variant: 'error' }); setClaimingInactivity(false); } }; @@ -122,9 +123,13 @@ export default (props: Props) => { )} Waiting for other player - + {claimingInactivity ? ( + + ) : ( + + )}