From ddadc1bf83c53f96d59bb8012b4b13f8c92f9301 Mon Sep 17 00:00:00 2001 From: Italo A Date: Sun, 26 Nov 2023 09:15:23 -0300 Subject: [PATCH 1/2] feat: better game actions and titles --- frontend/src/app/(private)/game/play/page.tsx | 71 +++++++++++++------ frontend/src/contexts/GameContext.tsx | 2 + 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/frontend/src/app/(private)/game/play/page.tsx b/frontend/src/app/(private)/game/play/page.tsx index 2b722f02..ecc59aae 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
); @@ -160,8 +191,8 @@ export default function PlayPage() { mx-auto " > -
Score: {gameData.score?.player1}
-
Score: {gameData.score?.player2}
+
Pontos: {gameData.score?.player1}
+
Pontos: {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; From 86dc459966b1a1561eb55185e07a2e8b44bd41f1 Mon Sep 17 00:00:00 2001 From: Italo A Date: Sun, 26 Nov 2023 09:20:02 -0300 Subject: [PATCH 2/2] feat: show player name on play screen --- frontend/src/app/(private)/game/play/page.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/(private)/game/play/page.tsx b/frontend/src/app/(private)/game/play/page.tsx index ecc59aae..591f5156 100644 --- a/frontend/src/app/(private)/game/play/page.tsx +++ b/frontend/src/app/(private)/game/play/page.tsx @@ -191,8 +191,12 @@ export default function PlayPage() { mx-auto " > -
Pontos: {gameData.score?.player1}
-
Pontos: {gameData.score?.player2}
+
+ {gameData.player1?.login}: {gameData.score?.player1} +
+
+ {gameData.player2?.login}: {gameData.score?.player2} +