mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 10:20:16 +01:00
fixed pbms found during demo
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
"use client";
|
||||
import { GameSettings } from "@/components/admin/gameSettings";
|
||||
import { PenaltySettings } from "@/components/admin/penaltySettings";
|
||||
import { TeamReady } from "@/components/admin/teamReady";
|
||||
import BlueButton, { GreenButton, RedButton } from "@/components/util/button";
|
||||
import { useAdminConnexion } from "@/context/adminConnexionContext";
|
||||
@@ -13,24 +15,28 @@ const LiveMap = dynamic(() => import('@/components/admin/mapPicker').then((mod)
|
||||
ssr: false
|
||||
});
|
||||
export default function AdminPage() {
|
||||
const { useProtect } = useAdminConnexion();
|
||||
const { useProtect } = useAdminConnexion();
|
||||
const { gameState, changeState } = useAdmin();
|
||||
useProtect();
|
||||
return (
|
||||
<div className='min-h-full bg-gray-200 p-10 flex flex-row content-start gap-5'>
|
||||
<div className="h-full">
|
||||
<div className='w-max h-1/2 gap-3 bg-white p-10 flex flex-col text-center shadow-2xl '>
|
||||
<div className="h-full w-2/6">
|
||||
<div className='w-full mb-5 h-1/2 gap-3 bg-white p-10 flex flex-col text-center shadow-2xl '>
|
||||
<h2 className="text-2xl">Game state </h2>
|
||||
<strong className="p-5 bg-gray-900 text-white text-xl rounded">Current : {gameState}</strong>
|
||||
<div className="flex flex-row">
|
||||
<RedButton onClick={() => changeState(GameState.SETUP)}>Reset game</RedButton>
|
||||
<GreenButton onClick={() => changeState(GameState.PLACEMENT)}>Start placement</GreenButton>
|
||||
<BlueButton onClick={() => changeState(GameState.PLAYING)}>Start game</BlueButton>
|
||||
</div>
|
||||
</div>
|
||||
<GameSettings />
|
||||
</div>
|
||||
{gameState == GameState.PLACEMENT && <div className="max-h-5/6"><TeamReady /></div>}
|
||||
{(gameState == GameState.SETUP || gameState == GameState.PLACEMENT) && <ZoneSelector />}
|
||||
{(gameState == GameState.SETUP || gameState == GameState.PLACEMENT) && <PenaltySettings />}
|
||||
{gameState == GameState.PLAYING && <div className='grow flex-1 row-span-2 bg-white p-10 flex shadow-2xl'>
|
||||
<LiveMap />
|
||||
<LiveMap />
|
||||
</div>}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -6,6 +6,7 @@ import { WaitingScreen } from '@/components/team/waitingScreen';
|
||||
import { LogoutButton } from '@/components/util/button';
|
||||
import { useSocket } from '@/context/socketContext';
|
||||
import { useTeamConnexion } from '@/context/teamConnexionContext';
|
||||
import { useTeamContext } from '@/context/teamContext';
|
||||
import useGame from '@/hook/useGame';
|
||||
import { GameState } from '@/util/gameState';
|
||||
import dynamic from 'next/dynamic';
|
||||
@@ -20,7 +21,8 @@ const PlacementMap = dynamic(() => import('@/components/team/map').then((mod) =>
|
||||
});
|
||||
|
||||
export default function Track() {
|
||||
const { gameState, captured } = useGame();
|
||||
const { gameState, captured } = useGame();
|
||||
const { gameSettings} = useTeamContext()
|
||||
const { useProtect } = useTeamConnexion();
|
||||
const { teamSocket: socket } = useSocket();
|
||||
useProtect();
|
||||
@@ -34,7 +36,7 @@ export default function Track() {
|
||||
}
|
||||
{gameState == GameState.PLAYING && captured && <div className='h-full'>
|
||||
<div className='text-center text-2xl'>Vous avez été capturé</div>
|
||||
<div className='text-center text-md'>Instructions de retour ici</div>
|
||||
<div className='text-center text-md'>{gameSettings?.capturedMessage}</div>
|
||||
</div>}
|
||||
{gameState == GameState.PLACEMENT &&
|
||||
<div className='h-full'>
|
||||
@@ -45,8 +47,8 @@ export default function Track() {
|
||||
{gameState == GameState.FINISHED && <div className='h-full'>
|
||||
<LogoutButton />
|
||||
<div className='text-center text-2xl'>Partie terminée</div>
|
||||
{captured && <div className='text-center text-md'>Vous avez perdu</div>}
|
||||
{!captured && <div className='text-center text-md'>Vous avez gagné</div>}
|
||||
{captured && <div className='text-center text-md'>{gameSettings?.loserEndGameMessage}</div>}
|
||||
{!captured && <div className='text-center text-md'>{gameSettings?.winnerEndGameMessage}</div>}
|
||||
</div>
|
||||
}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user