From 51a96db269ca61c32eba59f871d9cbf347c2a92c Mon Sep 17 00:00:00 2001 From: jisangs Date: Tue, 26 May 2026 18:18:43 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8B=B5=20=EC=9E=85=EB=A0=A5=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=EC=8B=9C=20=EC=A0=95=EB=8B=B5/=EC=98=A4=EB=8B=B5=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(game)/play/PlayClient.tsx | 2 +- components/game/FeedbackPanel.tsx | 72 ++++++++++++++++++++++++++--- components/math/KatexRenderer.tsx | 3 ++ lib/engine/parenthesis-sign.test.ts | 16 ++++--- lib/engine/parenthesis-sign.ts | 1 + lib/engine/types.ts | 1 + 6 files changed, 82 insertions(+), 13 deletions(-) diff --git a/app/(game)/play/PlayClient.tsx b/app/(game)/play/PlayClient.tsx index 2a5c6b4..e660acf 100644 --- a/app/(game)/play/PlayClient.tsx +++ b/app/(game)/play/PlayClient.tsx @@ -290,7 +290,7 @@ export default function PlayClient({ problemCount }: PlayClientProps) { {currentResult ? ( diff --git a/components/game/FeedbackPanel.tsx b/components/game/FeedbackPanel.tsx index 35c0d8a..63e2186 100644 --- a/components/game/FeedbackPanel.tsx +++ b/components/game/FeedbackPanel.tsx @@ -3,22 +3,38 @@ import { useEffect, useRef } from "react"; import KatexRenderer from "@/components/math/KatexRenderer"; -import type { GradeResult } from "@/lib/engine/types"; +import type { GradeResult, ParenthesisSignProblem } from "@/lib/engine/types"; interface FeedbackPanelProps { result: GradeResult; - answerLatex: string; + problem: ParenthesisSignProblem; isLastProblem: boolean; onNext: () => void; } +function formatSignedNumber(value: number) { + return value < 0 ? `(${value})` : `${value}`; +} + export default function FeedbackPanel({ result, - answerLatex, + problem, isLastProblem, onNext, }: FeedbackPanelProps) { const nextButtonRef = useRef(null); + const signedTerms = [ + problem.a, + problem.operator === "-" ? -problem.b : problem.b, + ] as const; + const feedbackItems = signedTerms.map((term, index) => ({ + formulaLatex: `${formatSignedNumber( + problem.multiplier, + )}\\times ${formatSignedNumber(term)}`, + userAnswer: result.userAnswer[index], + correctAnswer: result.correctAnswer[index], + correct: result.userAnswer[index] === result.correctAnswer[index], + })); useEffect(() => { nextButtonRef.current?.focus(); @@ -35,9 +51,53 @@ export default function FeedbackPanel({

{result.correct ? "정답입니다." : "오답입니다."}

-
- -
+
    + {feedbackItems.map((item, index) => ( +
  • + + + + + + {item.correct ? ( + + ○ + + ) : ( + <> + + × + + + ( + + + + ) + + + )} +
  • + ))} +