Build a couch co-op ready check
Track per-player readiness, exclude disconnected players, and start a couch co-op session exactly once when everyone is ready.Description
Requirements
Export CoopReadyCheck from src/App.tsx.
Render connection and ready state for each player with a labelled toggle for connected players.
Emit a readiness change only when the requested value differs from the current value.
Enable Start only when at least one player is connected and every connected player is ready.
Invoke onStart once per transition into the all-ready state and disable it while that state persists.
Expose visible status and interactive controls with native semantics, accessible names, and keyboard operation appropriate to the workflow.
Do not mutate props, nested caller-owned values, or arrays supplied to the component.
Everyone ready
Two connected players become ready
Start enables and invokes onStart once
Render connection and ready state for each player with a labelled toggle for connected players.
Disconnect
An unready player disconnects
Only remaining connected players determine readiness
Emit a readiness change only when the requested value differs from the current value.
Constraints
Use React state and effects only where the observable component contract requires themUse injected adapters instead of accessing network, storage, timers, or browser globals directlyKeep one authoritative state transition for each user or adapter event
Hints
Hint 1
Start with the per-player-ready behavior and make its observable result deterministic.
Hint 2
Model prevents-duplicate-toggle independently before combining it with the remaining states.
Hint 3
Verify the boundary described by starts-once without changing caller-owned input.