From 60b013f55cba476236e2c3aa3670240198f8ff52 Mon Sep 17 00:00:00 2001 From: Italo A Date: Mon, 27 Nov 2023 19:31:29 -0300 Subject: [PATCH] feat/game-actions (#134) * feat: better game actions and titles * feat: show player name on play screen --- frontend/src/app/(private)/game/play/page.tsx | 75 ++++++++++++++----- frontend/src/contexts/GameContext.tsx | 2 + 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/frontend/src/app/(private)/game/play/page.tsx b/frontend/src/app/(private)/game/play/page.tsx index 4e08fd31..e513c7b7 100644 --- a/frontend/src/app/(private)/game/play/page.tsx +++ b/frontend/src/app/(private)/game/play/page.tsx @@ -39,7 +39,7 @@ export default function PlayPage() { >
- Waiting for player 2... + Aguardando oponente...
@@ -51,22 +51,53 @@ export default function PlayPage() { <>
-
Game finished
-
- Player 1 Final Score: {gameFinishedData.score?.player1} - Player 2 Final Score: {gameFinishedData.score?.player2} +
+ Jogo finalizado +
+
+ + {gameFinishedData.player1.login} Pontos:{" "} + {gameFinishedData.score?.player1} + + + {gameFinishedData.player2.login} Pontos:{" "} + {gameFinishedData.score?.player2} + + + Vencedor:{" "} + {gameFinishedData.score?.player1 > gameFinishedData.score?.player2 + ? gameFinishedData.player1.login + : gameFinishedData.player2.login} + + + Voltar ao inicio +
@@ -90,7 +121,7 @@ export default function PlayPage() { h-[calc(100vh-130px)] " > -
Game abandoned
+
Jogo abandonado
); @@ -164,8 +195,12 @@ export default function PlayPage() { mx-auto " > -
Score: {gameData.score?.player1}
-
Score: {gameData.score?.player2}
+
+ {gameData.player1?.login}: {gameData.score?.player1} +
+
+ {gameData.player2?.login}: {gameData.score?.player2} +
- Quit the game + Sair do jogo
diff --git a/frontend/src/contexts/GameContext.tsx b/frontend/src/contexts/GameContext.tsx index 389df810..fb92a01d 100644 --- a/frontend/src/contexts/GameContext.tsx +++ b/frontend/src/contexts/GameContext.tsx @@ -18,6 +18,7 @@ export type GameData = { finished: boolean; player1: { id: string; + login: string; x: number; y: number; width: number; @@ -25,6 +26,7 @@ export type GameData = { }; player2: { id: string; + login: string; x: number; y: number; width: number;