From d743b4693c8054e3985f28ff584eb3992797828a Mon Sep 17 00:00:00 2001 From: pb-coding <71174645+pb-coding@users.noreply.github.com> Date: Sun, 24 Sep 2023 01:03:38 +0200 Subject: [PATCH] wip --- src/App.tsx | 5 +--- src/components/Footer.tsx | 60 ++++++++++++++++++++++++++++++--------- src/global/Button.tsx | 13 ++++++++- src/global/Text.tsx | 12 +++++--- 4 files changed, 68 insertions(+), 22 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index f123b32..f508aa0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,7 +5,6 @@ import GameCanvas from "./components/GameCanvas"; import { Footer } from "./components/Footer"; import { JoinSession } from "./components/JoinSession"; import { Game } from "./types/gameTypes"; -import { extractCurrentPlayer } from "./helpers"; import MessageDisplay from "./components/MessageDisplay"; export default function App() { @@ -19,8 +18,6 @@ export default function App() { const showStartGameButton = session !== "" && clientsInRoom >= 2; const showNextGameButton = gameData?.phase === "new round"; - const currentPlayerData = extractCurrentPlayer(gameData); - function setTempMessage(message: string) { setMessageDisplay(message); setTimeout(() => { @@ -82,7 +79,7 @@ export default function App() { isConnected={isConnected} session={session} clientsInRoom={clientsInRoom} - currentPlayerData={currentPlayerData} + playerData={gameData?.players ?? []} showNextGameButton={showNextGameButton} /> )} diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 953b379..2b29833 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -9,32 +9,66 @@ type Footer = { isConnected: boolean; session: string; clientsInRoom: number; - currentPlayerData: Player | undefined; + playerData: Player[]; showNextGameButton: boolean; }; +// TODO: use clients in room to validate player count + export const Footer: FC