mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 05:23:56 -07:00
gameboard fixes
This commit is contained in:
parent
88489ea2eb
commit
f534cd79b7
86 changed files with 4249 additions and 2145 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { RefObject, useCallback, useMemo, useRef, useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
|
||||
|
||||
import { createCardRegistry, type CardRegistry } from '@app/components';
|
||||
|
|
@ -29,7 +30,10 @@ export interface Game extends CurrentGame {
|
|||
}
|
||||
|
||||
export function useGame(): Game {
|
||||
const current = useCurrentGame();
|
||||
const params = useParams<{ gameId?: string }>();
|
||||
const parsed = params.gameId != null ? Number(params.gameId) : NaN;
|
||||
const routeGameId = Number.isFinite(parsed) ? parsed : undefined;
|
||||
const current = useCurrentGame(routeGameId);
|
||||
const { gameId, game, localPlayer, isSpectator } = current;
|
||||
|
||||
useGameLifecycleNavigation(gameId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue