import { useGameSocket } from './hooks/useGameSocket'; import { LanderCanvas } from './LanderCanvas'; // Vite dev server proxies `/ws` → `ws://localhost:5100`. In prod the backend // serves the built static files, so same-origin works there too. function buildWsUrl(): string { const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; return `${proto}//${window.location.host}/ws/game`; } export function App() { const { connected, state, sendCursor } = useGameSocket(buildWsUrl()); return ( <> ); } interface StatusBarProps { connected: boolean; step: number; } function StatusBar({ connected, step }: StatusBarProps) { return (
{' '} {connected ? 'connected' : 'disconnected'} · step {step}
); }