diff --git a/src/components/Counter/applyCountdown.js b/src/components/Counter/applyCountdown.js index e6859e5..5e74ebb 100644 --- a/src/components/Counter/applyCountdown.js +++ b/src/components/Counter/applyCountdown.js @@ -10,13 +10,12 @@ const applyCountdown = (WrappedComponent) => { const HOC = (props) => { const { gameId } = useParams(); const [finished, setFinished] = useState(false); - const [submit, setSubmit] = useState(false); const timeToSubmit = useSubscription(TIME_TO_SUBMIT, { variables: { gameId }, onSubscriptionData: ({ client, subscriptionData }) => { console.log("TIME TO SUBMIT"); - setSubmit(true); + setFinished(true); }, }); @@ -36,7 +35,7 @@ const applyCountdown = (WrappedComponent) => { }, []); const renderCounter = () => { - return !finished && !submit ? ( + return !finished ? ( setFinished(true)} @@ -50,7 +49,7 @@ const applyCountdown = (WrappedComponent) => {
{renderCounter()}
- + ); }; diff --git a/src/components/GameControls/PlayerControls.js b/src/components/GameControls/PlayerControls.js index 16699ad..decb922 100644 --- a/src/components/GameControls/PlayerControls.js +++ b/src/components/GameControls/PlayerControls.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; export default function PlayerControls({ joinGame, @@ -7,30 +7,30 @@ export default function PlayerControls({ loading, leaveGame, }) { + const [blocked, setBlocked] = useState(false); const displayMessage = () => { if (!hasJoined) { - if (!loading) { - return ( -
-

- Vous avez été invité à jouer à une partie de - esquissé, cliquez sur le bouton ci dessous pour - rejoindre les participants : -

- -
- ); - } else { - return

Connexion en cours

; - } + return ( +
+

+ Vous avez été invité à jouer à une partie de esquissé, + cliquez sur le bouton ci dessous pour rejoindre les + participants : +

+ +
+ ); } else { if (players.length < 3) { return ( diff --git a/src/components/GameModes/DrawingMode/index.js b/src/components/GameModes/DrawingMode/index.js index 68afbdf..e34a501 100644 --- a/src/components/GameModes/DrawingMode/index.js +++ b/src/components/GameModes/DrawingMode/index.js @@ -22,7 +22,12 @@ const DrawingMode = ({ lastPage, finished, pageId }) => { useEffect(() => { if (finished) { + console.log("THIS IS THE END SUBMIT NOW"); submitPage(); + setTimeout(function () { + console.log("SUBMITTING AGAIN CAPORAL!"); + submitPage(); + }, 2000); } }, [finished]); diff --git a/src/components/GameModes/GuessingMode/index.js b/src/components/GameModes/GuessingMode/index.js index 55e03c2..54620b0 100644 --- a/src/components/GameModes/GuessingMode/index.js +++ b/src/components/GameModes/GuessingMode/index.js @@ -20,7 +20,12 @@ const GuessingPanel = ({ lastPage, finished, pageId }) => { useEffect(() => { if (finished) { + console.log("THIS IS THE END SUBMIT NOW"); submitPage(); + setTimeout(function () { + console.log("SUBMITTING AGAIN CAPORAL!"); + submitPage(); + }, 2000); } }, [finished]); diff --git a/src/components/GameModes/index.js b/src/components/GameModes/index.js index 63cc528..79b7e77 100644 --- a/src/components/GameModes/index.js +++ b/src/components/GameModes/index.js @@ -21,7 +21,6 @@ export default function GameMode({ pages, turn, isGameMaster, setTime }) { }; const lastPage = getLastPage(currentPage, currentPageIndex); - console.log(isGameMaster, "isGameMaster"); const gameProps = { turn, isGameMaster, diff --git a/src/components/PdfFormat/index.js b/src/components/PdfFormat/index.js index aef8c10..3c1d960 100644 --- a/src/components/PdfFormat/index.js +++ b/src/components/PdfFormat/index.js @@ -17,7 +17,7 @@ export default function PdfFormat() {

Une si belle partie!

- avec la participation de{" "} + avec la participation de {data && data.getAllSketchbooks.map((sketchbook, index) => ( {sketchbook.creator?.name} diff --git a/src/components/StopGame/index.js b/src/components/StopGame/index.js index 3998367..17e31a5 100644 --- a/src/components/StopGame/index.js +++ b/src/components/StopGame/index.js @@ -17,12 +17,25 @@ export default function StopGame({ isGameMaster }) { console.log("ending game done"); }, }); + + //5 seconds to wait before receiving update game call with new turn const getTimer = () => { const timer = new Date(); timer.setSeconds(timer.getSeconds() + 5); return timer; }; + useEffect(() => { + //in case update called has not been received reload in 8 seconds + const reloadInCase = setTimeout(() => { + window.location.reload(); + }, 8000); + return function cleanup() { + console.log("CLEANING TIMEOUT"); + clearTimeout(reloadInCase); + }; + }); + const setTime = getTimer(); return (
diff --git a/src/layouts/ConnectedPages/Game/ActiveGame.js b/src/layouts/ConnectedPages/Game/ActiveGame.js index 47a4620..e685088 100644 --- a/src/layouts/ConnectedPages/Game/ActiveGame.js +++ b/src/layouts/ConnectedPages/Game/ActiveGame.js @@ -35,7 +35,6 @@ const ActiveGame = ({ gameInfo, userId }) => { }); if (loading) return ; - console.log("isGameMaster", userId === gameInfo.creator); return (