Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
lineville committed Apr 4, 2024
1 parent 2f39332 commit 4568740
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/app/game/[gameMode]/[gameType]/[gameId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,17 @@
import Game from "@/components/Game";
import { useEffect, useState } from "react";
import { v4 as uuidv4 } from "uuid";
import { GameMode } from "@/lib/gameMode";

export default function Page() {
const [clientId, setClientId] = useState<string>("");
const [gameMode, setGameMode] = useState<GameMode>(GameMode.MultiPlayer);

useEffect(() => {
const clientId = localStorage.getItem("clientId");
if (!clientId) {
localStorage.setItem("clientId", uuidv4());
}
setClientId(localStorage.getItem("clientId") as string);

// Determine game mode based on URL query parameters
const urlParams = new URLSearchParams(window.location.search);
const mode = urlParams.get('mode');
if (mode === GameMode.SinglePlayer) {
setGameMode(GameMode.SinglePlayer);
}
}, []);

return clientId && <Game clientId={clientId} gameMode={gameMode} />;
return clientId && <Game clientId={clientId} />;
}

0 comments on commit 4568740

Please sign in to comment.