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 ? "정답입니다." : "오답입니다."}

-
- -
+