import { useState } from 'react'; import { Logo } from '../components/Logo'; import { Button } from '../components/ui/Button'; import { Panel } from '../components/ui/Panel'; import { controlsHelp } from '../config/keybindings'; import type { Lobby } from '../net/types'; import type { GameActions } from '../net/useGameConnection'; import { itemVisuals } from '../theme/assets'; import styles from './LobbyPage.module.css'; interface Props { lobby: Lobby; playerId: string; actions: GameActions; } export function LobbyPage({ lobby, playerId, actions }: Props) { const [error, setError] = useState(null); const [copied, setCopied] = useState(false); const isHost = lobby.hostId === playerId; const copyLink = async () => { const url = `${window.location.origin}${window.location.pathname}?code=${lobby.code}`; try { await navigator.clipboard.writeText(url); setCopied(true); window.setTimeout(() => setCopied(false), 1500); } catch { setError(url); } }; const start = async () => { setError(null); try { await actions.startGame(); } catch (e) { setError(e instanceof Error ? e.message : String(e)); } }; return (
{lobby.code}
    {lobby.players.map((p) => (
  1. {p.name} {p.isHost && HOST} {p.id === playerId && YOU}
  2. ))}
{isHost ? ( ) : (

Waiting for the host to start...

)} {error &&

{error}

}
{lobby.lastResults && ( {lobby.lastResults.map((r) => ( ))}
#{r.place} {r.name} {r.score} {r.lines}L
)}
{controlsHelp.map((c) => (
{c.keys}
{c.action}
))}

Items hide inside blocks. Clear their line to collect them.

    {Object.entries(itemVisuals).map(([id, v]) => (
  • {v.name}
    {v.description}
  • ))}
); }