diff --git a/packages/client/src/routes/host.$roomCode.bingo.tsx b/packages/client/src/routes/host.$roomCode.bingo.tsx new file mode 100644 index 0000000..0d091e0 --- /dev/null +++ b/packages/client/src/routes/host.$roomCode.bingo.tsx @@ -0,0 +1,15 @@ +import { createFileRoute } from "@tanstack/react-router" +import { useRoomStore } from "@/stores/room-store" +import { BingoTab } from "@/components/bingo-tab" + +export const Route = createFileRoute("/host/$roomCode/bingo")({ + component: HostBingo, +}) + +function HostBingo() { + const { room, gameState, send } = useRoomStore() + + if (!room || !gameState) return null + + return +} diff --git a/packages/client/src/routes/host.$roomCode.board.tsx b/packages/client/src/routes/host.$roomCode.board.tsx new file mode 100644 index 0000000..5299929 --- /dev/null +++ b/packages/client/src/routes/host.$roomCode.board.tsx @@ -0,0 +1,15 @@ +import { createFileRoute } from "@tanstack/react-router" +import { useRoomStore } from "@/stores/room-store" +import { BoardTab } from "@/components/board-tab" + +export const Route = createFileRoute("/host/$roomCode/board")({ + component: HostBoard, +}) + +function HostBoard() { + const { room, gameState } = useRoomStore() + + if (!room || !gameState) return null + + return +} diff --git a/packages/client/src/routes/host.$roomCode.game.tsx b/packages/client/src/routes/host.$roomCode.game.tsx new file mode 100644 index 0000000..0aa502b --- /dev/null +++ b/packages/client/src/routes/host.$roomCode.game.tsx @@ -0,0 +1,15 @@ +import { createFileRoute } from "@tanstack/react-router" +import { useRoomStore } from "@/stores/room-store" +import { GameTab } from "@/components/game-tab" + +export const Route = createFileRoute("/host/$roomCode/game")({ + component: HostGame, +}) + +function HostGame() { + const { room, gameState, send } = useRoomStore() + + if (!room || !gameState) return null + + return +} diff --git a/packages/client/src/routes/host.$roomCode.host.tsx b/packages/client/src/routes/host.$roomCode.host.tsx new file mode 100644 index 0000000..3d2c922 --- /dev/null +++ b/packages/client/src/routes/host.$roomCode.host.tsx @@ -0,0 +1,16 @@ +import { createFileRoute } from "@tanstack/react-router" +import { useRoomStore } from "@/stores/room-store" +import { HostTab } from "@/components/host-tab" + +export const Route = createFileRoute("/host/$roomCode/host")({ + component: HostControls, +}) + +function HostControls() { + const { roomCode } = Route.useParams() + const { room, gameState, send } = useRoomStore() + + if (!room || !gameState) return null + + return +} diff --git a/packages/client/src/routes/host.$roomCode.index.tsx b/packages/client/src/routes/host.$roomCode.index.tsx new file mode 100644 index 0000000..cc10026 --- /dev/null +++ b/packages/client/src/routes/host.$roomCode.index.tsx @@ -0,0 +1,7 @@ +import { createFileRoute, redirect } from "@tanstack/react-router" + +export const Route = createFileRoute("/host/$roomCode/")({ + beforeLoad: ({ params }) => { + throw redirect({ to: "/host/$roomCode/game", params }) + }, +}) diff --git a/packages/client/src/routes/host.$roomCode.tsx b/packages/client/src/routes/host.$roomCode.tsx index af0ad1d..ea904a2 100644 --- a/packages/client/src/routes/host.$roomCode.tsx +++ b/packages/client/src/routes/host.$roomCode.tsx @@ -1,43 +1,17 @@ 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 { PredictionsForm } from "@/components/predictions-form" -import { JuryHost } from "@/components/jury-host" -import { JuryVoting } from "@/components/jury-voting" -import { BingoCard } from "@/components/bingo-card" -import { ActualResultsForm } from "@/components/actual-results-form" -import { QuizHost } from "@/components/quiz-host" -import { QuizBuzzer } from "@/components/quiz-buzzer" -import { Leaderboard } from "@/components/leaderboard" -import { RoomHeader } from "@/components/room-header" -import { Button } from "@/components/ui/button" -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import type { Act } from "@celebrate-esc/shared" +import { RoomLayout } from "@/components/room-layout" +import { BottomNav } from "@/components/bottom-nav" export const Route = createFileRoute("/host/$roomCode")({ - component: HostView, + component: HostLayout, }) -const nextActLabels: Partial> = { - lobby: "Start Pre-Show", - "pre-show": "Start Live Event", - "live-event": "Start Scoring", - scoring: "End Party", -} - -const prevActLabels: Partial> = { - "pre-show": "Back to Lobby", - "live-event": "Back to Pre-Show", - scoring: "Back to Live Event", - ended: "Back to Scoring", -} - -function HostView() { +function HostLayout() { const { roomCode } = Route.useParams() - const { send } = useWebSocket(roomCode) - const { room, mySessionId, connectionStatus, gameState } = useRoomStore() + useWebSocket(roomCode) + const { room, connectionStatus } = useRoomStore() if (!room) { return ( @@ -50,175 +24,9 @@ function HostView() { } return ( -
- - - - - Play - - - Host - - - - {gameState && (room.currentAct === "lobby" || room.currentAct === "pre-show") && ( -
- - send({ type: "submit_prediction", ...prediction }) - } - /> -
- )} - - {gameState && room.currentAct === "live-event" && ( - - - Jury - Bingo - - - {gameState.currentJuryRound ? ( - send({ type: "submit_jury_vote", rating })} - /> - ) : ( -
- Waiting for host to open voting... -
- )} -
- - {gameState.myBingoCard ? ( - send({ type: "tap_bingo_square", tropeId })} - /> - ) : ( -
- No bingo card yet -
- )} -
-
- )} - - {gameState && (room.currentAct === "scoring" || room.currentAct === "ended") && gameState.myPrediction && ( - {}} - /> - )} - - {gameState && room.currentAct === "scoring" && gameState.currentQuizQuestion && ( - send({ type: "buzz" })} - /> - )} - - {gameState && (room.currentAct === "scoring" || room.currentAct === "ended") && ( - - )} - - -
- -
- - - Room Controls - - - {room.currentAct !== "ended" && ( -
- {room.currentAct !== "lobby" && ( - - )} - -
- )} - {room.currentAct !== "ended" && ( - - )} - {room.currentAct === "ended" && ( -
-

- The party has ended. Thanks for playing! -

- -
- )} - {room.currentAct === "live-event" && gameState && ( - send({ type: "open_jury_vote", countryCode })} - onCloseVote={() => send({ type: "close_jury_vote" })} - /> - )} - {gameState && room.currentAct === "scoring" && ( - send({ type: "start_quiz_question" })} - onJudge={(correct) => send({ type: "judge_quiz_answer", correct })} - onSkip={() => send({ type: "skip_quiz_question" })} - /> - )} - {gameState && (room.currentAct === "scoring" || room.currentAct === "ended") && ( - send({ type: "submit_actual_results", ...results })} - /> - )} - {gameState && (room.currentAct === "scoring" || room.currentAct === "ended") && ( - - )} -
-
- -
-
-
-
+ <> + + + ) }