From 09a7d2ce91746e4757b9e5db4ca1ce4011e717e0 Mon Sep 17 00:00:00 2001 From: exl7954 Date: Tue, 30 Apr 2024 15:39:44 -0400 Subject: [PATCH] fix enter key duping score --- frontend/src/Pages/Game/GuessingBox.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/Pages/Game/GuessingBox.js b/frontend/src/Pages/Game/GuessingBox.js index 2326fee..d874ab6 100644 --- a/frontend/src/Pages/Game/GuessingBox.js +++ b/frontend/src/Pages/Game/GuessingBox.js @@ -84,7 +84,13 @@ export default function GuessingBox({ useEffect(() => { const handleKeyPress = (e) => { if (e.key === "Enter") { - handleGuess(); + if (!isOpen) { + handleGuess(); + } else { + onClose(); + if (progression < 4) setProgression(progression + 1); + else setStage("postGame"); + } } }; window.addEventListener("keydown", handleKeyPress);