diff --git a/src/components/AIQuiz/AIOpenEndedQuestion.tsx b/src/components/AIQuiz/AIOpenEndedQuestion.tsx index a4a7dfe9f..453fa5d3b 100644 --- a/src/components/AIQuiz/AIOpenEndedQuestion.tsx +++ b/src/components/AIQuiz/AIOpenEndedQuestion.tsx @@ -23,6 +23,8 @@ type AIOpenEndedQuestionProps = { isLastQuestion: boolean; onComplete: () => void; + + onSkip: () => void; }; export function AIOpenEndedQuestion(props: AIOpenEndedQuestionProps) { @@ -36,6 +38,7 @@ export function AIOpenEndedQuestion(props: AIOpenEndedQuestionProps) { setCorrectAnswer, isLastQuestion, onComplete, + onSkip, } = props; const { title: questionText } = question; @@ -118,25 +121,35 @@ export function AIOpenEndedQuestion(props: AIOpenEndedQuestionProps) { )} - - {isVerifying ? ( - - ) : isSubmittedAndNotSkipped ? ( - isLastQuestion ? ( - 'Finish Quiz' + + + Skip Question + + + + {isVerifying ? ( + + ) : isSubmittedAndNotSkipped ? ( + isLastQuestion ? ( + 'Finish Quiz' + ) : ( + 'Next Question' + ) ) : ( - 'Next Question' - ) - ) : ( - 'Verify Answer' - )} - + 'Verify Answer' + )} + + ); } diff --git a/src/components/AIQuiz/AIQuizContent.tsx b/src/components/AIQuiz/AIQuizContent.tsx index f2f7f1cb7..5c4dd9f76 100644 --- a/src/components/AIQuiz/AIQuizContent.tsx +++ b/src/components/AIQuiz/AIQuizContent.tsx @@ -146,7 +146,9 @@ export function AIQuizContent(props: AIQuizContentProps) { }; const handleSkip = () => { - handleSubmit('skipped'); + const prevStatus = questionStates[activeQuestionIndex]?.status ?? 'pending'; + handleSubmit(prevStatus === 'pending' ? 'skipped' : prevStatus); + if (hasNextQuestion) { handleNextQuestion(); } else { @@ -231,6 +233,7 @@ export function AIQuizContent(props: AIQuizContentProps) { setCorrectAnswer={handleSetCorrectAnswer} isLastQuestion={isLastQuestion} onComplete={handleComplete} + onSkip={handleSkip} /> )} > diff --git a/src/components/AIQuiz/AIQuizGenerator.tsx b/src/components/AIQuiz/AIQuizGenerator.tsx index c94ab9580..45153cc3e 100644 --- a/src/components/AIQuiz/AIQuizGenerator.tsx +++ b/src/components/AIQuiz/AIQuizGenerator.tsx @@ -1,7 +1,9 @@ import { - FileTextIcon, ListIcon, - ListTodoIcon, SparklesIcon, - type LucideIcon + FileTextIcon, + ListIcon, + ListTodoIcon, + SparklesIcon, + type LucideIcon, } from 'lucide-react'; import { useEffect, useId, useState } from 'react'; import { isLoggedIn } from '../../lib/jwt'; @@ -246,7 +248,7 @@ export function AIQuizGenerator() {