diff --git a/client/src/components/GameBoard.tsx b/client/src/components/GameBoard.tsx index a73cd35..3e22064 100644 --- a/client/src/components/GameBoard.tsx +++ b/client/src/components/GameBoard.tsx @@ -18,6 +18,9 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB // Orden aleatorio de cartas de misión (se genera una vez) const [cardOrder] = useState(() => Math.random() > 0.5); + // Track del voto de misión del jugador + const [missionVote, setMissionVote] = useState(null); + // Timer para avanzar automáticamente en REVEAL_ROLE useEffect(() => { @@ -29,6 +32,14 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB } }, [gameState.phase, actions]); + // Reset missionVote cuando cambia la fase + useEffect(() => { + if (gameState.phase !== GamePhase.MISSION) { + setMissionVote(null); + } + }, [gameState.phase]); + + const currentPlayer = gameState.players.find(p => p.id === currentPlayerId); const isLeader = gameState.currentLeaderId === currentPlayerId; // FIX: Usar currentLeaderId del estado const config = GAME_CONFIG[gameState.players.length as keyof typeof GAME_CONFIG]; @@ -45,6 +56,12 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB } }; + const handleMissionVote = (vote: boolean) => { + setMissionVote(vote); + actions.voteMission(vote); + }; + + // Coordenadas porcentuales de los hexágonos de misión en el mapa const missionCoords = [ { left: '12%', top: '55%' }, // Misión 1 @@ -506,7 +523,7 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB whileHover={{ scale: 1.1, rotate: 3 }} whileTap={{ scale: 0.95 }} > - Success + Success ÉXITO @@ -519,7 +536,7 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB whileHover={{ scale: 1.1, rotate: -3 }} whileTap={{ scale: 0.95 }} > - Fail + Fail SABOTAJE @@ -535,7 +552,7 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB whileHover={{ scale: 1.1, rotate: -3 }} whileTap={{ scale: 0.95 }} > - Fail + Fail SABOTAJE @@ -548,7 +565,7 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB whileHover={{ scale: 1.1, rotate: 3 }} whileTap={{ scale: 0.95 }} > - Success + Success ÉXITO