From aeeb1533657dc32b4237f961fe2fd99b41c2ea29 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Thu, 8 Jan 2026 01:10:28 +0100 Subject: [PATCH] Add showExplanation state and update quiz logic in QuizRunner --- client/src/components/QuizRunner.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/src/components/QuizRunner.tsx b/client/src/components/QuizRunner.tsx index 130f377..51b4b64 100644 --- a/client/src/components/QuizRunner.tsx +++ b/client/src/components/QuizRunner.tsx @@ -207,6 +207,7 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt const [response, setResponse] = useState(null); const [showResult, setShowResult] = useState(false); const [lastCorrect, setLastCorrect] = useState(false); + const [showExplanation, setShowExplanation] = useState(false); const [error, setError] = useState(null); useEffect(() => { @@ -230,6 +231,7 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt setResponse(null); setShowResult(false); setLastCorrect(false); + setShowExplanation(false); }; const startQuiz = async () => { @@ -301,6 +303,7 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt } setLastCorrect(correct); setShowResult(true); + setShowExplanation(!correct); }; const goNext = () => { @@ -355,6 +358,7 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt const targets = resolveTargets(currentQuestion); const correctText = deriveCorrectText(currentQuestion); + const shouldShowExplanation = showResult && (!lastCorrect || showExplanation); return (