diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2023-07-15 02:46:14 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2023-07-15 02:46:14 +0530 |
commit | 72e89afac0f11d59e4399f245e6dcc728bec38d9 (patch) | |
tree | 481d5b9fb330f1a3528aa772dacf4a20e035fe65 /src/components/App.js | |
parent | 6036a220e251a9963e62508ae7dfeb68b2f289a2 (diff) |
cleaned up code, added timeout, etc
Diffstat (limited to 'src/components/App.js')
-rw-r--r-- | src/components/App.js | 88 |
1 files changed, 43 insertions, 45 deletions
diff --git a/src/components/App.js b/src/components/App.js index 5b13230..3217782 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -35,56 +35,54 @@ const App = () => { const [isHost, setIsHost] = useState(false); const [joinCode, setJoinCode] = useState(); - return gameStarted ? ( + return ( <> - {showMessageBox && - <MessageBox - message={message} - setShowMessage={setShowMessageBox} - /> - } + {gameStarted ? + <> + {showMessageBox && + <MessageBox + message={message} + setShowMessage={setShowMessageBox} + /> + } - <ScoreBoard - turn={turn} - scoreX={scoreX} - scoreO={scoreO} - multiplayer={multiplayer} - isHost={isHost} - /> + <ScoreBoard + turn={turn} + scoreX={scoreX} + scoreO={scoreO} + multiplayer={multiplayer} + isHost={isHost} + /> - {multiplayer ? <MultiplayerGrid - turn={turn} - isHost={isHost} - setTurn={setTurn} - scoreX={scoreX} - setScoreX={setScoreX} - scoreO={scoreO} - setScoreO={setScoreO} - setMessage={setMessage} - setShowMessage={setShowMessageBox} - joinCode={joinCode} - /> : <Grid - turn={turn} - setTurn={setTurn} - scoreX={scoreX} - setScoreX={setScoreX} - scoreO={scoreO} - setScoreO={setScoreO} - setMessage={setMessage} - setShowMessage={setShowMessageBox} + {multiplayer ? <MultiplayerGrid + turn={turn} + isHost={isHost} + setTurn={setTurn} + scoreX={scoreX} + setScoreX={setScoreX} + scoreO={scoreO} + setScoreO={setScoreO} + setMessage={setMessage} + setShowMessage={setShowMessageBox} + joinCode={joinCode} + /> : <Grid + turn={turn} + setTurn={setTurn} + scoreX={scoreX} + setScoreX={setScoreX} + scoreO={scoreO} + setScoreO={setScoreO} + setMessage={setMessage} + setShowMessage={setShowMessageBox} + /> + } + </> : <GamemodeChooser + setMultiplayer={setMultiplayer} + setGameStarted={setGameStarted} + setIsHost={setIsHost} + setJoinCode={setJoinCode} /> } - - <Footer/> - </> - ) : ( - <> - <GamemodeChooser - setMultiplayer={setMultiplayer} - setGameStarted={setGameStarted} - setIsHost={setIsHost} - setJoinCode={setJoinCode} - /> <Footer/> </> ); |