Add VotingTimer component back
This commit is contained in:
@@ -563,3 +563,24 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Subcomponente para el Timer de Votación
|
||||||
|
function VotingTimer({ onTimeout }: { onTimeout: () => void }) {
|
||||||
|
const [timeLeft, setTimeLeft] = useState(10);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (timeLeft <= 0) {
|
||||||
|
onTimeout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const interval = setInterval(() => setTimeLeft(t => t - 1), 1000);
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
}, [timeLeft, onTimeout]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="absolute top-4 right-4 bg-red-600/80 text-white w-16 h-16 rounded-full flex items-center justify-center border-4 border-red-400 animate-pulse text-2xl font-bold font-mono">
|
||||||
|
{timeLeft}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user