From 643343b9036b348a123b4d5e71da3f5ed628ab5b Mon Sep 17 00:00:00 2001 From: Quentin Roussel Date: Sat, 20 Apr 2024 13:23:06 +0200 Subject: [PATCH] game over basic frontend --- traque-front/app/team/track/page.js | 18 +++++++++++++----- traque-front/components/team/waitingScreen.jsx | 6 ++---- traque-front/components/util/button.jsx | 7 +++++++ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/traque-front/app/team/track/page.js b/traque-front/app/team/track/page.js index c5364de..a054ccc 100644 --- a/traque-front/app/team/track/page.js +++ b/traque-front/app/team/track/page.js @@ -3,7 +3,8 @@ import ActionDrawer from '@/components/team/actionDrawer'; import { Notification } from '@/components/team/notification'; import PlacementOverlay from '@/components/team/placementOverlay'; import { WaitingScreen } from '@/components/team/waitingScreen'; -import { useSocket } from '@/context/socketContext'; +import { LogoutButton } from '@/components/util/button'; +import { useSocket } from '@/context/socketContext'; import { useTeamConnexion } from '@/context/teamConnexionContext'; import useGame from '@/hook/useGame'; import { GameState } from '@/util/gameState'; @@ -19,12 +20,12 @@ const PlacementMap = dynamic(() => import('@/components/team/map').then((mod) => }); export default function Track() { - const { gameState, captured} = useGame(); + const { gameState, captured } = useGame(); const { useProtect } = useTeamConnexion(); - const { teamSocket: socket} = useSocket(); + const { teamSocket: socket } = useSocket(); useProtect(); return <> - + {gameState == GameState.SETUP && } {gameState == GameState.PLAYING && !captured &&
@@ -32,7 +33,7 @@ export default function Track() {
} {gameState == GameState.PLAYING && captured &&
-
Vous avez été capturé
+
Vous avez été capturé
Instructions de retour ici
} {gameState == GameState.PLACEMENT && @@ -41,5 +42,12 @@ export default function Track() { } + {gameState == GameState.FINISHED &&
+ +
Partie terminée
+ {captured &&
Vous avez perdu
} + {!captured &&
Vous avez gagné
} +
+ } } diff --git a/traque-front/components/team/waitingScreen.jsx b/traque-front/components/team/waitingScreen.jsx index 907ad51..db58d46 100644 --- a/traque-front/components/team/waitingScreen.jsx +++ b/traque-front/components/team/waitingScreen.jsx @@ -1,12 +1,10 @@ -import { useTeamConnexion } from "@/context/teamConnexionContext"; import useGame from "@/hook/useGame" -import { GreenButton } from "../util/button"; +import { GreenButton, LogoutButton } from "../util/button"; import { useRef } from "react"; export function WaitingScreen() { const { name, teamId } = useGame(); const imageRef = useRef(null); - const { logout } = useTeamConnexion(); const SERVER_URL = "https://" + process.env.NEXT_PUBLIC_SOCKET_HOST + ":" + process.env.NEXT_PUBLIC_SOCKET_PORT; function sendImage() { @@ -29,6 +27,7 @@ export function WaitingScreen() { return (
+
Equipe : {name}
@@ -43,7 +42,6 @@ export function WaitingScreen() {
{teamId && ) } \ No newline at end of file diff --git a/traque-front/components/util/button.jsx b/traque-front/components/util/button.jsx index 6d32417..49290d4 100644 --- a/traque-front/components/util/button.jsx +++ b/traque-front/components/util/button.jsx @@ -1,3 +1,5 @@ +import { useTeamConnexion } from "@/context/teamConnexionContext"; + export default function BlueButton({ children, ...props }) { return () +} + +export function LogoutButton() { + const { logout } = useTeamConnexion(); + return } \ No newline at end of file