Fix: Auto-avanzar de MISSION_REVEAL a MISSION_RESULT
- Servidor avanza automáticamente después de 5 segundos - Resuelve problema de quedarse bloqueado en pantalla de votos - Cliente muestra 'Procesando resultado...'
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
import { motion } from 'framer-motion';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
interface MissionRevealProps {
|
||||
votes: boolean[];
|
||||
}
|
||||
|
||||
export default function MissionReveal({ votes }: MissionRevealProps) {
|
||||
// Auto-avanzar después de mostrar todas las cartas
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
// El servidor avanzará automáticamente
|
||||
// Este timer es solo para dar tiempo a ver las cartas
|
||||
}, 3000 + votes.length * 300); // 3s base + 300ms por carta
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [votes.length]);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
className="fixed inset-0 flex flex-col items-center justify-center bg-black/90 z-50"
|
||||
@@ -16,8 +27,9 @@ export default function MissionReveal({ votes }: MissionRevealProps) {
|
||||
{votes.map((vote, idx) => (
|
||||
<motion.div
|
||||
key={idx}
|
||||
className={`w-24 h-32 rounded-lg flex items-center justify-center text-5xl font-bold text-white ${vote ? 'bg-blue-600' : 'bg-red-600'
|
||||
}`}
|
||||
className={`w - 24 h - 32 rounded - lg flex items - center justify - center text - 5xl font - bold text - white ${
|
||||
vote ? 'bg-blue-600' : 'bg-red-600'
|
||||
} `}
|
||||
initial={{ scale: 0, rotate: -180 }}
|
||||
animate={{ scale: 1, rotate: 0 }}
|
||||
transition={{ delay: idx * 0.3 }}
|
||||
@@ -26,7 +38,7 @@ export default function MissionReveal({ votes }: MissionRevealProps) {
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
<p className="text-white text-xl">Los resultados se revelarán automáticamente...</p>
|
||||
<p className="text-white text-xl">Procesando resultado...</p>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -243,8 +243,14 @@ export class Game {
|
||||
this.state.revealedVotes = shuffledVotes; // Las cartas a revelar
|
||||
|
||||
this.log(`Misión ${round} completada. Revelando votos...`);
|
||||
|
||||
// Auto-avanzar a MISSION_RESULT después de 5 segundos
|
||||
setTimeout(() => {
|
||||
this.finishReveal();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
|
||||
// Método para avanzar desde MISSION_REVEAL a MISSION_RESULT
|
||||
finishReveal() {
|
||||
this.state.phase = GamePhase.MISSION_RESULT;
|
||||
|
||||
Reference in New Issue
Block a user