Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
simlmx committed Jul 22, 2024
1 parent f4fd958 commit 0d62449
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/dev-server/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ const BoardForPlayer = ({
const storeRef = useRef<Store | null>(null);

useEffect(() => {
if (!match) {
return;
}
const { players } = match;
const { store: mainStore } = match;
const { board, playerboards } = mainStore.getState();
Expand Down Expand Up @@ -139,7 +136,7 @@ const BoardForPlayer = ({
setLoading(false);
}, [userId, match]);

if (loading || !match) {
if (loading) {
return <div>Loading player...</div>;
}

Expand Down Expand Up @@ -174,6 +171,12 @@ function RulesWrapper({
);
}

function getUserIds(numPlayers: number) {
return Array(numPlayers)
.fill(null)
.map((_, i) => i.toString());
}

/*
* Deep copy an object.
*/
Expand Down Expand Up @@ -596,12 +599,6 @@ const initMatch = ({
return match;
};

function getUserIds(numPlayers: number) {
return Array(numPlayers)
.fill(null)
.map((_, i) => i.toString());
}

async function render({
game,
board,
Expand Down Expand Up @@ -646,9 +643,10 @@ async function render({

// Is it the player's board?
if (userId !== null) {
const match = ((window.top as any).lefun as Lefun).match;
const content = (
<BoardForPlayer
match={((window.top as any).lefun as Lefun)?.match}
match={match}
board={await board()}
userId={userId}
messages={messages[locale]}
Expand Down

0 comments on commit 0d62449

Please sign in to comment.