diff --git a/client/src/components/context/GameContext.tsx b/client/src/components/context/GameContext.tsx index 522a1e9..3c6f3b1 100644 --- a/client/src/components/context/GameContext.tsx +++ b/client/src/components/context/GameContext.tsx @@ -35,9 +35,13 @@ export const GameContextProvider = ({ children }: PropsWithChildren) => { const contextValue = useMemo( () => ({ game: created ?? joined, - createGame: async (isSandbox: boolean, player: Nation | null) => - createGame({ isSandbox, player }), - joinGame: async (gameId: number, player: Nation | null) => joinGame({ gameId, player }), + createGame: async ( + isSandbox: boolean, + player: Nation | null, + hasStrictAdjacencies: boolean, + ) => createGame({ isSandbox, player, hasStrictAdjacencies }), + joinGame: async (gameId: number, isSandbox: boolean, player: Nation | null) => + joinGame({ gameId, isSandbox, player }), exitGame: () => { queryClient.removeQueries(); resetCreate(); diff --git a/client/src/components/pages/JoinGamePage.tsx b/client/src/components/pages/JoinGamePage.tsx index 5acaace..b4084a8 100644 --- a/client/src/components/pages/JoinGamePage.tsx +++ b/client/src/components/pages/JoinGamePage.tsx @@ -7,6 +7,7 @@ import GameContext from '../context/GameContext'; import Error from '../user-interface/common/Error'; import TextInput from '../user-interface/common/TextInput'; import { isInteger } from '../../utils/numberUtils'; +import Select from '../user-interface/common/Select'; type JoinGameProps = { setViewOption: (option: SetupViewOption) => void; @@ -16,6 +17,7 @@ const JoinGamePage = ({ setViewOption }: JoinGameProps) => { const { joinGame, exitGame, isLoading, error } = useContext(GameContext); const [gameId, setGameId] = useState(); + const [isSandbox, setIsSandbox] = useState(false); const [player, setPlayer] = useState(); const onGameIdChanged = (value: string) => { @@ -30,7 +32,7 @@ const JoinGamePage = ({ setViewOption }: JoinGameProps) => { const onJoinPressed = () => { if (gameId === undefined) return; - joinGame(gameId ?? 0, player ?? null); + joinGame(gameId ?? 0, isSandbox, player ?? null); }; const onBackPressed = () => { @@ -42,7 +44,21 @@ const JoinGamePage = ({ setViewOption }: JoinGameProps) => {
Logo - + setHasStrictAdjacencies(value === 'true')} + selectedValue={hasStrictAdjacencies ? 'true' : 'false'} + />