feat(web): add multiplayer lobby, game, and score screen routes
- lobby.$code.tsx: waiting room with live player list via lobby:state, copyable lobby code, host Start Game button (disabled until 2+ players), sends lobby:join on connect, lobby:leave on unmount - game.$code.tsx: in-game view, sends game:ready on mount to get current question, handles game:question/answer_result/finished messages, reuses QuestionCard component, shows round results after each answer - MultiplayerScoreScreen: final score screen sorted by score, highlights winner(s) with crown, handles ties via winnerIds array, Play Again navigates back to lobby, Leave goes to multiplayer landing - GameRouteSearchSchema added to shared for typed lobbyId search param without requiring Zod in apps/web
This commit is contained in:
parent
d064338145
commit
f2eb6ce17f
5 changed files with 340 additions and 11 deletions
|
|
@ -27,6 +27,9 @@ export const JoinLobbyResponseSchema = LobbySchema;
|
|||
|
||||
export type JoinLobbyResponse = z.infer<typeof JoinLobbyResponseSchema>;
|
||||
|
||||
export const GameRouteSearchSchema = z.object({ lobbyId: z.uuid() });
|
||||
export type GameRouteSearch = z.infer<typeof GameRouteSearchSchema>;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WebSocket: Client → Server
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue