diff --git a/app/(game)/play/PlayClient.tsx b/app/(game)/play/PlayClient.tsx index 7af82aa..75a41df 100644 --- a/app/(game)/play/PlayClient.tsx +++ b/app/(game)/play/PlayClient.tsx @@ -16,13 +16,14 @@ import KatexRenderer from "@/components/math/KatexRenderer"; import { useGameStore } from "@/store/gameStore"; import type { ProblemCount } from "@/store/gameStore"; -const MOBILE_BREAKPOINT_QUERY = "(min-width: 640px)"; +const DESKTOP_INPUT_DEVICE_QUERY = "(any-hover: hover) and (any-pointer: fine)"; const MOBILE_KEYBOARD_SPACER_OFFSET = 480; +const REAL_NUMBER_PATTERN = /^-?\d+(?:\.\d+)?$/; function parseAnswer(value: string) { const trimmed = value.trim(); - if (!/^-?\d+$/.test(trimmed)) return null; + if (!REAL_NUMBER_PATTERN.test(trimmed)) return null; return Number(trimmed); } @@ -108,7 +109,7 @@ export default function PlayClient({ problemCount }: PlayClientProps) { const parsedB = parseAnswer(answerB); if (parsedA === null || parsedB === null) { - setInputError("두 칸 모두 정수로 입력하세요."); + setInputError("두 칸 모두 실수로 입력하세요."); return; } @@ -128,7 +129,7 @@ export default function PlayClient({ problemCount }: PlayClientProps) { }, []); const scrollKatexToViewportTop = useCallback(() => { - if (window.matchMedia(MOBILE_BREAKPOINT_QUERY).matches) return; + if (window.matchMedia(DESKTOP_INPUT_DEVICE_QUERY).matches) return; function alignKatex() { const katexElement = @@ -301,7 +302,6 @@ export default function PlayClient({ problemCount }: PlayClientProps) { {!submitted && mobileFocusSpacerHeight > 0 ? (
(function Answer ); })}
+ + {keypadOpen && !desktopInputDevice ? ( +
+ {KEYPAD_KEYS.map((key) => ( + + ))} + + + +
+ ) : null} {error ? (