diff --git a/app/components/host-view.tsx b/app/components/host-view.tsx index 856ef44..3890ef5 100644 --- a/app/components/host-view.tsx +++ b/app/components/host-view.tsx @@ -332,11 +332,13 @@ const LobbyControls = ({ Game Lobby - send({ type: "REMOVE_PLAYER", playerId })} - /> +
+ send({ type: "REMOVE_PLAYER", playerId })} + /> +
(); - const [searchParams] = useSearchParams(); - const code = searchParams.get("code"); - - // Create local atoms - const [$gameCode] = useState(() => atom(code || "")); const [$showHelp] = useState(() => atom(false)); - const [$isJoining] = useState(() => atom(false)); return ( ); } type HomePageContentProps = { newGameId: string; - $gameCode: ReturnType>; $showHelp: ReturnType>; - $isJoining: ReturnType>; }; function HomePageContent({ newGameId, - $gameCode, $showHelp, - $isJoining, }: HomePageContentProps) { const { deviceType, host } = useLoaderData(); const isMobile = deviceType === "mobile"; const showHelp = useStore($showHelp); - const isJoining = useStore($isJoining); - const gameCode = useStore($gameCode); - const client = SessionContext.useClient(); - const navigate = useNavigate(); - - const handleJoinGame = async (e: React.FormEvent) => { - e.preventDefault(); - const gameCode = $gameCode.get(); - if (!gameCode) return; - - $isJoining.set(true); - const [error] = await catchError( - client.waitFor((state) => !!state.public.gameIdsByJoinCode[gameCode]) - ); - if (error) { - console.warn(error); - } - const gameId = client.getState().public.gameIdsByJoinCode[gameCode]; - if (gameId) { - navigate(`/games/${gameId}`); - } - - $isJoining.set(false); - }; const HelpModal = () => ( {isMobile ? ( - // Mobile view - show game controls - <> -
-

- Join a Game -

-
-
- - - $gameCode.set(e.target.value.toUpperCase()) - } - placeholder="Enter game code" - maxLength={6} - disabled={isJoining} - /> -
- - {isJoining ? ( - <> -
- Joining... - - ) : ( - <> - - Join Game - - )} - - -
- -
-

- Start a New Game -

- - - - Create New Game - - -
- + // Mobile view - show only create game option +
+

+ Start a New Game +

+ + + + Create New Game + + +
) : ( // Desktop view - show TV mode message
diff --git a/stories/_index.stories.tsx b/stories/_index.stories.tsx index a63ce5f..5cf1b71 100644 --- a/stories/_index.stories.tsx +++ b/stories/_index.stories.tsx @@ -110,9 +110,8 @@ export const MobileView: Story = { }, }; -/** - * Story demonstrating the mobile view with a pre-filled game code - */ +// Commenting out join game related stories +/* export const MobileWithGameCode: Story = { parameters: { remix: { @@ -135,9 +134,6 @@ export const MobileWithGameCode: Story = { }, }; -/** - * Interactive story demonstrating the game joining flow on mobile - */ export const JoinGameInteraction: Story = { decorators: [ (Story) => { @@ -205,3 +201,4 @@ export const JoinGameInteraction: Story = { }); }, }; +*/