From 326da377c9af586472d185e883d89a42edb1df65 Mon Sep 17 00:00:00 2001 From: jisangs Date: Wed, 27 May 2026 18:09:59 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AA=A8=EB=B0=94=EC=9D=BC=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=EC=97=90=EC=84=9C=EB=A7=8C=20=EC=8B=A4=ED=96=89?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EA=B0=80=EC=83=81=20=ED=82=A4=EB=B3=B4?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(game)/play/PlayClient.tsx | 10 +- components/game/AnswerForm.tsx | 210 ++++++++++++++++++++++++++------- 2 files changed, 171 insertions(+), 49 deletions(-) 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 ? (