import React, { useState, useEffect } from 'react'; import { ChevronLeft, ChevronRight, SkipBack, SkipForward, Play, Pause, Info } from 'lucide-react'; import { LotomaniaGame } from '../types'; import LotomaniaGrid from './LotomaniaGrid'; interface GameViewerProps { games: LotomaniaGame[]; currentGameId: number; onGameChange: (gameId: number) => void; } const GameViewer: React.FC = ({ games, currentGameId, onGameChange }) => { const [isAutoPlay, setIsAutoPlay] = useState(false); const [autoPlaySpeed, setAutoPlaySpeed] = useState(1000); // ms const currentGame = games.find(game => game.id === currentGameId); const currentIndex = games.findIndex(game => game.id === currentGameId); // Auto-play functionality useEffect(() => { if (!isAutoPlay) return; const interval = setInterval(() => { if (currentIndex < games.length - 1) { onGameChange(games[currentIndex + 1].id); } else { setIsAutoPlay(false); } }, autoPlaySpeed); return () => clearInterval(interval); }, [isAutoPlay, currentIndex, games, onGameChange, autoPlaySpeed]); const goToFirstGame = () => { if (games.length > 0) { onGameChange(games[0].id); } }; const goToLastGame = () => { if (games.length > 0) { onGameChange(games[games.length - 1].id); } }; const goToPreviousGame = () => { if (currentIndex > 0) { onGameChange(games[currentIndex - 1].id); } }; const goToNextGame = () => { if (currentIndex < games.length - 1) { onGameChange(games[currentIndex + 1].id); } }; const jumpToGame = (gameId: number) => { onGameChange(gameId); }; if (!currentGame) { return (
Jogo não encontrado
); } return (
{/* Header com informações do jogo */}

Jogo #{currentGame.id}

Fase {currentGame.phase} • Ciclo {currentGame.cycle} • {currentIndex + 1} de {games.length} jogos

{Math.round(((currentIndex + 1) / games.length) * 100)}%
Concluído
{/* Controles de Navegação */}
{/* Controles principais */}
{/* Barra de progresso */}
Progresso dos Jogos {currentIndex + 1} / {games.length}
{/* Input para saltar para jogo específico */}
{ const gameId = parseInt(e.target.value); if (gameId >= 1 && gameId <= games.length) { jumpToGame(gameId); } }} className="w-20 px-3 py-1 border border-gray-300 rounded-md text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent" /> {/* Velocidade do auto-play */}
{/* Grid do jogo atual */}
{/* Informações detalhadas do jogo */}

Informações do Jogo

ID do Jogo: #{currentGame.id}
Fase: {currentGame.phase}
Ciclo: {currentGame.cycle}
Posição: {currentIndex + 1} / {games.length}

Colunas Marcadas

{currentGame.markedColumns.map(col => ( {col} ))}

Total: {currentGame.markedColumns.length * 10} números

Estatísticas

Números marcados: {currentGame.markedColumns.length * 10}
Cobertura: {currentGame.markedColumns.length * 10}%
Progresso: {Math.round(((currentIndex + 1) / games.length) * 100)}%
{/* Navegação rápida */}

Navegação Rápida

{[1, 10, 50, 100, 500, 1000].filter(jump => jump <= games.length).map(jump => ( ))}
); }; export default GameViewer;