From 385f87cce0dcfc8ce865af79d5fc01fd548c1a56 Mon Sep 17 00:00:00 2001 From: Resistencia Dev Date: Mon, 15 Dec 2025 09:57:58 +0100 Subject: [PATCH] =?UTF-8?q?Afegit=20bot=C3=B3=20per=20ocultar/mostrar=20l'?= =?UTF-8?q?historial=20de=20missions=20amb=20animaci=C3=B3=20de=20lliscame?= =?UTF-8?q?nt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/GameBoard.tsx | 119 +++++++++++++++++++--------- 1 file changed, 81 insertions(+), 38 deletions(-) diff --git a/client/src/components/GameBoard.tsx b/client/src/components/GameBoard.tsx index bb07475..af787f0 100644 --- a/client/src/components/GameBoard.tsx +++ b/client/src/components/GameBoard.tsx @@ -28,6 +28,9 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB // Estado para controlar el colapso del panel de jugadores const [isPlayersCollapsed, setIsPlayersCollapsed] = useState(false); + // Estado para controlar el colapso del historial de misiones + const [isHistoryCollapsed, setIsHistoryCollapsed] = useState(false); + // Timer para avanzar automáticamente en REVEAL_ROLE useEffect(() => { @@ -879,47 +882,87 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB {/* HISTÓRICO DE MISIONES (Esquina superior derecha) */} {gameState.missionHistory.length > 0 && ( -
-
Historial
-
- {gameState.missionHistory.map((mission, idx) => { - const isExpanded = expandedMission === idx; + + {/* Botón de colapso/expansión */} + setIsHistoryCollapsed(!isHistoryCollapsed)} + className="absolute top-0 bg-gradient-to-l from-yellow-600 to-yellow-700 hover:from-yellow-500 hover:to-yellow-600 text-white rounded-l-lg px-2 py-3 shadow-lg border-2 border-yellow-500 border-r-0 transition-all hover:shadow-yellow-500/50 flex items-center" + initial={false} + animate={{ + right: isHistoryCollapsed ? '0px' : '100%' + }} + transition={{ type: "spring", stiffness: 300, damping: 30 }} + > + + + + - return ( -
-
{ - e.stopPropagation(); - console.log('Click en misión', idx); - setExpandedMission(prev => prev === idx ? null : idx); - }} - > - {mission.round} -
+ {/* Panel del historial */} + +
Historial
+
+ {gameState.missionHistory.map((mission, idx) => { + const isExpanded = expandedMission === idx; - {/* Lista de participantes */} - {isExpanded && ( -
- {mission.team.map((playerId) => { - const player = gameState.players.find(p => p.id === playerId); - return ( -
- {player?.name || playerId} -
- ); - })} + return ( +
+
{ + e.stopPropagation(); + console.log('Click en misión', idx); + setExpandedMission(prev => prev === idx ? null : idx); + }} + > + {mission.round}
- )} -
- ); - })} -
-
+ + {/* Lista de participantes */} + {isExpanded && ( +
+ {mission.team.map((playerId) => { + const player = gameState.players.find(p => p.id === playerId); + return ( +
+ {player?.name || playerId} +
+ ); + })} +
+ )} +
+ ); + })} +
+ + )}