diff --git a/client/src/components/GameRoot.tsx b/client/src/components/GameRoot.tsx index b1f547f..7f6dee3 100644 --- a/client/src/components/GameRoot.tsx +++ b/client/src/components/GameRoot.tsx @@ -28,6 +28,7 @@ const GameRoot = () => { initialPositionX={initialOffsetX} initialPositionY={initialOffsetY} doubleClick={{ disabled: true }} + panning={{ excluded: ['input', 'select'] }} > {error && } {!world && } diff --git a/client/src/components/context/OrderEntryContext.tsx b/client/src/components/context/OrderEntryContext.tsx index 59f1522..7e5d8d9 100644 --- a/client/src/components/context/OrderEntryContext.tsx +++ b/client/src/components/context/OrderEntryContext.tsx @@ -11,6 +11,8 @@ export const OrderEntryContextProvider = ({ children }: PropsWithChildren) => { useEffect(() => { const handleKeyPress = (event: KeyboardEvent) => { + if (document.activeElement?.tagName === 'INPUT') return; + switch (event.key) { case '1': dispatch({ $type: OrderEntryActionType.SetMode, mode: InputMode.Hold }); diff --git a/client/src/components/pages/JoinGamePage.tsx b/client/src/components/pages/JoinGamePage.tsx index ea63d3e..5acaace 100644 --- a/client/src/components/pages/JoinGamePage.tsx +++ b/client/src/components/pages/JoinGamePage.tsx @@ -5,6 +5,8 @@ import Button from '../user-interface/common/Button'; import NationSelect from '../user-interface/NationSelect'; import GameContext from '../context/GameContext'; import Error from '../user-interface/common/Error'; +import TextInput from '../user-interface/common/TextInput'; +import { isInteger } from '../../utils/numberUtils'; type JoinGameProps = { setViewOption: (option: SetupViewOption) => void; @@ -17,15 +19,12 @@ const JoinGamePage = ({ setViewOption }: JoinGameProps) => { const [player, setPlayer] = useState(); const onGameIdChanged = (value: string) => { - const parsedValue = parseInt(value, 10); - if ( - parsedValue.toString() !== value || - Number.isNaN(parsedValue) || - !Number.isInteger(parsedValue) - ) { + if (!isInteger(value)) { setGameId(undefined); return; } + + const parsedValue = parseInt(value, 10); setGameId(parsedValue); }; @@ -42,12 +41,7 @@ const JoinGamePage = ({ setViewOption }: JoinGameProps) => { return (
Logo - onGameIdChanged(event.target.value)} - /> +