diff --git a/traque-front/app/team/track/page.js b/traque-front/app/team/track/page.js index 92f698a..fb16cbd 100644 --- a/traque-front/app/team/track/page.js +++ b/traque-front/app/team/track/page.js @@ -7,18 +7,34 @@ import dynamic from 'next/dynamic'; import React from 'react' //Load the map without SSR -const LiveMap = dynamic(() => import('@/components/team/map'), { +const LiveMap = dynamic(() => import('@/components/team/map').then((mod) => mod.LiveMap), { + ssr: false +}); +const PlacementMap = dynamic(() => import('@/components/team/map').then((mod) => mod.PlacementMap), { ssr: false }); export default function Track() { - const { gameState } = useGame(); - const {useProtect} = useTeamConnexion(); + const { gameState, name, ready } = useGame(); + const { useProtect } = useTeamConnexion(); useProtect(); - return ( - gameState == GameState.PLAYING &&
+ return <> + {gameState == GameState.PLAYING &&
- ) + } + {gameState == GameState.PLACEMENT && +
+
+
Placement
+
{name}
+ {!ready &&
Positionez vous dans le cercle
} + {ready &&
Restez dans le cercle en attendant que la partie commence
} + +
+ +
+ } + } diff --git a/traque-front/components/team/map.jsx b/traque-front/components/team/map.jsx index c224ab5..fab937e 100644 --- a/traque-front/components/team/map.jsx +++ b/traque-front/components/team/map.jsx @@ -1,6 +1,6 @@ 'use client'; import React, { useEffect, useState } from 'react' -import { MapContainer, Marker, Popup, TileLayer, useMap } from 'react-leaflet' +import { Circle, MapContainer, Marker, Popup, TileLayer, useMap } from 'react-leaflet' import 'leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css' import "leaflet-defaulticon-compatibility"; import "leaflet/dist/leaflet.css"; @@ -24,7 +24,7 @@ function MapPan(props) { return null; } -export default function LiveMap({ ...props}) { +export function LiveMap({ ...props}) { const {currentPosition, enemyPosition} = useGame(); useEffect(() => { console.log('Current position', currentPosition); @@ -65,12 +65,24 @@ export default function LiveMap({ ...props}) { export function PlacementMap({ ...props}) { const {currentPosition, startingArea} = useGame(); return ( - + + {currentPosition && + + Votre position + + } + ) } diff --git a/traque-front/hook/useGame.jsx b/traque-front/hook/useGame.jsx index ca54ad5..c867a23 100644 --- a/traque-front/hook/useGame.jsx +++ b/traque-front/hook/useGame.jsx @@ -24,6 +24,7 @@ export default function useGame() { startingArea: teamInfos?.startingArea || null, captureCode: teamInfos?.captureCode || null, name: teamInfos?.name || null, + ready: teamInfos?.ready || false, teamId, gameState, };