From 0561f9350bad50d77344a30bc8dae5206ce9a2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20F=C3=B6rtsch?= Date: Thu, 12 Mar 2026 17:43:58 +0100 Subject: [PATCH] update routes: remove dish UI, update act refs, add copy-to-clipboard on lobby display Co-Authored-By: Claude Opus 4.6 --- .../client/src/routes/display.$roomCode.tsx | 64 +++++++++++++------ packages/client/src/routes/host.$roomCode.tsx | 48 +++++--------- packages/client/src/routes/play.$roomCode.tsx | 27 ++------ 3 files changed, 69 insertions(+), 70 deletions(-) diff --git a/packages/client/src/routes/display.$roomCode.tsx b/packages/client/src/routes/display.$roomCode.tsx index 20f9ed6..bfb7cc4 100644 --- a/packages/client/src/routes/display.$roomCode.tsx +++ b/packages/client/src/routes/display.$roomCode.tsx @@ -1,9 +1,10 @@ +import { useState } from "react" import { createFileRoute } from "@tanstack/react-router" import { useWebSocket } from "@/hooks/use-websocket" import { useRoomStore } from "@/stores/room-store" import { PlayerList } from "@/components/player-list" -import { DishResults } from "@/components/dish-results" import { RoomHeader } from "@/components/room-header" +import { ACT_LABELS } from "@celebrate-esc/shared" export const Route = createFileRoute("/display/$roomCode")({ component: DisplayView, @@ -29,44 +30,71 @@ function DisplayView() {
{room.currentAct === "lobby" && } - {gameState?.dishResults && ( -
- -
- )} - {room.currentAct === "act1" && gameState && !gameState.dishResults && ( + {room.currentAct === "pre-show" && gameState && (
-

Act 1 — Predictions & Dishes

+

Pre-Show — Predictions

- {gameState.dishes.length} dish(es) added + {Object.values(gameState.predictionSubmitted).filter(Boolean).length} / {Object.keys(gameState.predictionSubmitted).length} predictions submitted

)} - + {room.currentAct !== "lobby" && room.currentAct !== "ended" && room.currentAct !== "pre-show" && ( +
+

{ACT_LABELS[room.currentAct]}

+
+ )} + + {room.currentAct === "ended" && ( +
+

The party has ended. Thanks for playing!

+
+ )} + +
) } function LobbyDisplay({ roomCode }: { roomCode: string }) { - const joinUrl = `${window.location.origin}/play/${roomCode}` + const [copied, setCopied] = useState(false) + const base = import.meta.env.BASE_URL.replace(/\/$/, "") + const joinUrl = `${window.location.origin}${base}/play/${roomCode}` + + function copyCode() { + navigator.clipboard.writeText(roomCode).then(() => { + setCopied(true) + setTimeout(() => setCopied(false), 2000) + }) + } return (

Join the party!

-
+
+ +

+ {copied ? ( + Copied! + ) : ( + <>Tap the code to copy + )} +

Go to {joinUrl}

-

or scan the QR code

- {/* QR code will be added in Plan 5 (polish) */} -
- QR code -
) } diff --git a/packages/client/src/routes/host.$roomCode.tsx b/packages/client/src/routes/host.$roomCode.tsx index 398703c..a34559a 100644 --- a/packages/client/src/routes/host.$roomCode.tsx +++ b/packages/client/src/routes/host.$roomCode.tsx @@ -3,9 +3,6 @@ import { useWebSocket } from "@/hooks/use-websocket" import { useRoomStore } from "@/stores/room-store" import { PlayerList } from "@/components/player-list" import { PredictionsForm } from "@/components/predictions-form" -import { DishList } from "@/components/dish-list" -import { DishHost } from "@/components/dish-host" -import { DishResults } from "@/components/dish-results" import { RoomHeader } from "@/components/room-header" import { Button } from "@/components/ui/button" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" @@ -17,10 +14,10 @@ export const Route = createFileRoute("/host/$roomCode")({ }) const nextActLabels: Partial> = { - lobby: "Start Act 1", - act1: "Start Act 2", - act2: "Start Act 3", - act3: "End Party", + lobby: "Start Pre-Show", + "pre-show": "Start Live Event", + "live-event": "Start Scoring", + scoring: "End Party", } function HostView() { @@ -51,30 +48,23 @@ function HostView() { - {gameState && (room.currentAct === "lobby" || room.currentAct === "act1") && ( + {gameState && room.currentAct !== "ended" && (
send({ type: "submit_prediction", ...prediction }) } /> - - send({ type: "submit_dish_guess", dishId, guessedCountry }) - } - />
)} - {gameState?.dishResults && ( - - )} - +
@@ -104,17 +94,11 @@ function HostView() { )} - {gameState && (room.currentAct === "lobby" || room.currentAct === "act1") && ( - - send({ type: "add_dish", name, correctCountry }) - } - onReveal={() => send({ type: "reveal_dishes" })} - /> - )} - +
diff --git a/packages/client/src/routes/play.$roomCode.tsx b/packages/client/src/routes/play.$roomCode.tsx index 54fa454..f431a7d 100644 --- a/packages/client/src/routes/play.$roomCode.tsx +++ b/packages/client/src/routes/play.$roomCode.tsx @@ -4,8 +4,6 @@ import { useWebSocket } from "@/hooks/use-websocket" import { useRoomStore } from "@/stores/room-store" import { PlayerList } from "@/components/player-list" import { PredictionsForm } from "@/components/predictions-form" -import { DishList } from "@/components/dish-list" -import { DishResults } from "@/components/dish-results" import { RoomHeader } from "@/components/room-header" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" @@ -21,7 +19,6 @@ function PlayerView() { const joinSentRef = useRef(false) const [manualName, setManualName] = useState("") - // Auto-send join_room when connected for the first time (no existing session) useEffect(() => { if (connectionStatus !== "connected" || mySessionId || joinSentRef.current) return @@ -43,8 +40,6 @@ function PlayerView() { ) } - // Fallback: if no stored display name and no session (e.g., direct URL access), - // show a name input form if (!mySessionId && connectionStatus === "connected" && !joinSentRef.current) { return (
@@ -94,38 +89,30 @@ function PlayerView() {
)} - {gameState && (room.currentAct === "lobby" || room.currentAct === "act1") && ( + {gameState && room.currentAct !== "ended" && (
send({ type: "submit_prediction", ...prediction }) } /> - - send({ type: "submit_dish_guess", dishId, guessedCountry }) - } - />
)} - {gameState?.dishResults && ( - - )} - {room.currentAct === "ended" && (

The party has ended. Thanks for playing!

)} - + )