import { useGameConnection } from './net/useGameConnection'; import { GamePage } from './pages/GamePage'; import { HomePage } from './pages/HomePage'; import { LobbyPage } from './pages/LobbyPage'; import styles from './App.module.css'; const statusText = { connecting: 'Connecting to server...', reconnecting: 'Connection lost, reconnecting...', disconnected: 'Server unreachable, retrying...', connected: '', }; export function App() { const { status, playerId, lobby, match, flashes, actions } = useGameConnection(); let content; if (!lobby || !playerId) { content = ; } else if (match) { content = ; } else if (lobby.phase === 'playing') { content =
Starting...
; } else { content = ; } return ( <> {status !== 'connected' &&
{statusText[status]}
} {content} ); }