import { List } from '@/components/list'; import useAdmin from '@/hook/useAdmin'; import { GameState } from '@/util/gameState'; const TEAM_STATUS = { playing: { label: "En jeu", color: "text-custom-green" }, captured: { label: "Capturée", color: "text-custom-red" }, outofzone: { label: "Hors zone", color: "text-custom-orange" }, ready: { label: "Placée", color: "text-custom-green" }, notready: { label: "Non placée", color: "text-custom-red" }, waiting: { label: "En attente", color: "text-custom-grey" }, }; function getStatus(team, gamestate) { switch (gamestate) { case GameState.SETUP: return TEAM_STATUS.waiting; case GameState.PLACEMENT: return team.ready ? TEAM_STATUS.ready : TEAM_STATUS.notready; case GameState.PLAYING: return team.captured ? TEAM_STATUS.captured : team.outofzone ? TEAM_STATUS.outofzone : TEAM_STATUS.playing; case GameState.FINISHED: return team.captured ? TEAM_STATUS.captured : TEAM_STATUS.playing; } } function TeamViewerItem({ team, itemSelected, onSelected }) { const { gameState } = useAdmin(); const status = getStatus(team, gameState); return (
onSelected(team.id)}>
0 ? "green" : "red"}.png`} className="w-4 h-4" /> = 20 ? "green" : "red"}.png`} className="w-4 h-4" />

{team.name}

{status.label}

); } export default function TeamViewer({selectedTeamId, onSelected}) { const { teams } = useAdmin(); return ( {(team) => ( )} ); }