Determine canSubmit based on question type and response

This commit is contained in:
2026-01-08 02:10:46 +01:00
parent 639b59ce3f
commit 2fa955e0ad

View File

@@ -464,6 +464,13 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt
onChange={setResponse} onChange={setResponse}
showResult={showResult} showResult={showResult}
lastCorrect={lastCorrect} lastCorrect={lastCorrect}
canSubmit={Boolean(
(currentQuestion.type === 'cloze' && response && String(response).trim().length > 0) ||
(currentQuestion.type === 'match' && response && Object.values(response).every((v) => v)) ||
((currentQuestion.type || '').startsWith('mc') && typeof response === 'number') ||
(currentQuestion.type === 'choose_best_reply' && typeof response === 'number') ||
(!currentQuestion.type && typeof response === 'number')
)}
/> />
{showResult && ( {showResult && (