From 8f1b4b8470b265d1337d234c3446b13ada4139bd Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Wed, 26 Mar 2025 14:30:06 +0000 Subject: [PATCH] Improve test my knowledge --- .../GenerateCourse/TestMyKnowledgeAction.tsx | 212 ++++++++++-------- 1 file changed, 113 insertions(+), 99 deletions(-) diff --git a/src/components/GenerateCourse/TestMyKnowledgeAction.tsx b/src/components/GenerateCourse/TestMyKnowledgeAction.tsx index b138d2caa..ef676b02e 100644 --- a/src/components/GenerateCourse/TestMyKnowledgeAction.tsx +++ b/src/components/GenerateCourse/TestMyKnowledgeAction.tsx @@ -116,31 +116,33 @@ export function TestMyKnowledgeAction(props: TestMyKnowledgeActionProps) { return (
-
- -
+ {!isKnowledgeTestOpen && ( +
+ +
+ )} {error && (
@@ -258,6 +260,7 @@ export function ListQuestions(props: ListQuestionsProps) { return ( void; @@ -292,9 +296,8 @@ export function QuizItem(props: QuizItemProps) { const { totalQuestions, correctAnswerCount, - + counter, isLoading, - question, onOptionSelectChange, selectedOptionIds, @@ -322,87 +325,98 @@ export function QuizItem(props: QuizItemProps) { return (
- {submitted && ( - - {hasWrongAnswer ? 'Wrong' : 'Correct'} +
+ + Question {counter} of {totalQuestions} - )} -

- {title} {canMultiSelect ? '(Select Multiple)' : ''} -

- -
- {options.map((option, index) => { - let status: QuizOptionStatus = 'default'; - if (submitted) { - if (option.isCorrect) { - status = 'correct'; - } else if (selectedOptionIds?.includes(option.id)) { - status = 'wrong'; - } - } else { - if (selectedOptionIds?.includes(option.id)) { - status = 'selected'; - } - } - - return ( - onOptionSelectChange?.(questionId, option.id)} - submitted={submitted} - /> - ); - })} +
+
+
+ {submitted && ( + + {hasWrongAnswer ? 'Wrong' : 'Correct'} + + )}
-
-
- {submitted ? ( - - You got {correctAnswerCount} out of {totalQuestions} correct. - - - ) : ( - Answer all questions to submit - )} +
+

+ {title} {canMultiSelect ? '(Select Multiple)' : ''} +

+ +
+ {options.map((option, index) => { + let status: QuizOptionStatus = 'default'; + if (submitted) { + if (option.isCorrect) { + status = 'correct'; + } else if (selectedOptionIds?.includes(option.id)) { + status = 'wrong'; + } + } else { + if (selectedOptionIds?.includes(option.id)) { + status = 'selected'; + } + } + + return ( + onOptionSelectChange?.(questionId, option.id)} + submitted={submitted} + /> + ); + })}
-
- - +
+
+ {submitted ? ( + + You got {correctAnswerCount} out of {totalQuestions} correct. + + + ) : ( + Answer all questions to submit + )} +
+ +
+ + +