diff --git a/frontend/src/Navbar.tsx b/frontend/src/Navbar.tsx index a8b84aa..688690f 100644 --- a/frontend/src/Navbar.tsx +++ b/frontend/src/Navbar.tsx @@ -241,7 +241,7 @@ const Navbar: React.FC = () => { size="medium" fontSize="text-2xl" onClick={() => { - modal.show(aboutUs, 'large', [ + modal.show("aboutUsModal",aboutUs, 'large', [ { text: 'Close', type: 'submit', @@ -260,7 +260,7 @@ const Navbar: React.FC = () => { size="medium" fontSize="text-2xl" onClick={() => { - modal.show(rules, 'large', [ + modal.show("rulesModal",rules, 'large', [ { text: 'Close', type: 'submit', diff --git a/frontend/src/pages/Game.tsx b/frontend/src/pages/Game.tsx index 4555fae..a491c2e 100644 --- a/frontend/src/pages/Game.tsx +++ b/frontend/src/pages/Game.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { useGameContext } from '../contexts/GameContext'; import Button from '../library/button'; import { useModal } from '../library/modal/ModalContext'; @@ -61,8 +61,23 @@ function Game() { const navigate = useNavigate(); const [FirstUser, setFirstUser] = useState(true); const modal = useModal(); + const initialMount = useRef(true); useEffect(() => { - modal.show(, 'large', [], false); + if (initialMount.current) { + modal.show( + 'gameModal', + , + 'large', + [], + false + ); + initialMount.current = false; + } else { + modal.updateContent( + 'gameModal', + + ); + } // eslint-disable-next-line }, [gameState.players.length, gameState.id]); // todo add the required dependencies const drawCard = () => { @@ -102,7 +117,7 @@ function Game() { modal.hide(); } - function GamePropertiesModal() { + function GamePropertiesModal({ playerCount }: { playerCount: number }) { const currentUser = getUser(); const isHost = currentUser && @@ -135,7 +150,7 @@ function Game() {

Players Joined :{' '} - {gameState.players.length} + {playerCount}

@@ -283,7 +298,15 @@ function Game() {