import React from 'react'; import { GameData, GameState } from '../types'; interface SpectatorViewProps { game: GameData; } const SpectatorView: React.FC = ({ game }) => { const currentQ = game.questions[game.currentQuestionIndex]; return (
{/* Background Ambience */}
{game.state === GameState.LOBBY && (

JOIN THE QUIZ!

{/* Simulate QR Code */}
{[...Array(16)].map((_, i) => (
0.5 ? 'bg-white' : 'bg-transparent'}`}>
))}
Visit URL:
QUIZ.LIVE/BM-123

PLAYERS JOINED:

{game.players.filter(p => p.status === 'APPROVED').map(p => ( {p.name} ))}
)} {game.state === GameState.COUNTDOWN && (
{game.countdownValue}
)} {game.state === GameState.QUESTION && (
QUESTION {game.currentQuestionIndex + 1}

{currentQ.text}

Waiting for buzzers...
)} {game.state === GameState.BUZZED && (

{currentQ.text}

PLAYER BUZZED!
{game.players.find(p => p.id === game.activeBuzzerQueue[0]?.playerId)?.name || 'Someone'}
)} {game.state === GameState.REVEAL && (

THE ANSWER IS...

{currentQ.answer}
Points awarded to {game.players.find(p => p.id === game.activeBuzzerQueue[0]?.playerId)?.teamId}!
)} {game.state === GameState.SCOREBOARD && (

LEADERBOARD

{game.players .sort((a, b) => b.score - a.score) .slice(0, 5) .map((p, i) => (
{i+1} {p.name} ({p.teamId})
{p.score} pts
))}
)} {game.state === GameState.FINAL_STATS && (

GAME OVER!

🏆 FINAL CHAMPIONS 🏆

THE NERDS
)}
); }; const StatBox: React.FC<{ label: string; sub: string; value: string }> = ({ label, sub, value }) => (
{sub}
{label}
{value}
); export default SpectatorView;