Interface d'attente + logout

This commit is contained in:
Quentin Roussel
2024-03-29 12:38:12 +01:00
parent cee7c1e612
commit 3770dd4f99
8 changed files with 63 additions and 13 deletions

View File

@@ -1,5 +1,7 @@
"use client";
import ActionDrawer from '@/components/team/actionDrawer';
import PlacementOverlay from '@/components/team/placementOverlay';
import { WaitingScreen } from '@/components/team/waitingScreen';
import { useTeamConnexion } from '@/context/teamConnexionContext';
import useGame from '@/hook/useGame';
import { GameState } from '@/util/gameState';
@@ -15,10 +17,11 @@ const PlacementMap = dynamic(() => import('@/components/team/map').then((mod) =>
});
export default function Track() {
const { gameState, name, ready } = useGame();
const { gameState} = useGame();
const { useProtect } = useTeamConnexion();
useProtect();
return <>
{gameState == GameState.SETUP && <WaitingScreen />}
{gameState == GameState.PLAYING && <div className='h-full'>
<LiveMap />
<ActionDrawer />
@@ -26,13 +29,7 @@ export default function Track() {
}
{gameState == GameState.PLACEMENT &&
<div className='h-full'>
<div className='fixed t-0 p-3 w-full bg-gray-300 shadow-xl rounded-b-xl flex flex-col z-10 justify-center items-center'>
<div className='text-2xl my-3'>Placement</div>
<div className='text-m'>{name}</div>
{!ready && <div className='text-lg font-semibold text-red-700'>Positionez vous dans le cercle</div>}
{ready && <div className='text-lg font-semibold text-green-700 text-center'>Restez dans le cercle en attendant que la partie commence</div>}
</div>
<PlacementOverlay />
<PlacementMap />
</div>
}