diff --git a/src/pages/FeedbackPage.jsx b/src/pages/FeedbackPage.jsx index a296376..5da508a 100644 --- a/src/pages/FeedbackPage.jsx +++ b/src/pages/FeedbackPage.jsx @@ -9,7 +9,6 @@ function FeedbackPage() { const selectedAnswers = location.state?.selectedAnswers || {}; const currentIndex = location.state?.currentIndex ?? 0; - // NEW: backend result support const score = location.state?.score ?? 0; const total = location.state?.total ?? questions.length; const correctAnswers = location.state?.correctAnswers ?? score; @@ -30,7 +29,7 @@ function FeedbackPage() { const question = questions[currentIndex]; const userAnswer = selectedAnswers[currentIndex]; - const correctAnswer = question.correctAnswer; + const correctAnswer = question.answer; const isCorrect = userAnswer === correctAnswer; return ( @@ -57,7 +56,7 @@ function FeedbackPage() {
@@ -69,9 +68,7 @@ function FeedbackPage() {
-

- {isCorrect ? "Great job!" : "Keep going!"} -

+

{isCorrect ? "Great job!" : "Keep going!"}

{isCorrect ? "You're on the right track." @@ -84,18 +81,19 @@ function FeedbackPage() {

{question.question}

- {question.options.map((option, index) => { + {Object.entries(question.options).map(([key, value]) => { let boxClass = "feedback-option-box"; - if (option === correctAnswer) boxClass += " correct-box"; - if (userAnswer === option && option !== correctAnswer) + if (key === correctAnswer) boxClass += " correct-box"; + if (userAnswer === key && key !== correctAnswer) { boxClass += " wrong-box"; + } return ( -
- {option} - {option === correctAnswer && Correct Answer} - {userAnswer === option && option !== correctAnswer && ( +
+ {key}: {value} + {key === correctAnswer && Correct Answer} + {userAnswer === key && key !== correctAnswer && ( Your Selection )}
@@ -107,27 +105,20 @@ function FeedbackPage() {

AI Explanation

-
- LUCID MENTOR ANALYSIS -
+
LUCID MENTOR ANALYSIS

{isCorrect ? "Great job. Your answer matches the expected reasoning." - : "Think of this like searching in a sorted structure. Efficient algorithms eliminate large portions quickly, which is why ordering matters."} + : "Think of this like searching through a well-organized structure. The correct answer follows the underlying concept tested in the question, so focus on the principle rather than guessing from similar-looking choices."}

- - +
@@ -135,15 +126,16 @@ function FeedbackPage() {
Pro Tip

- Efficient searching depends on structure. Ordered data allows - faster algorithms. + Efficient problem solving depends on understanding the structure + behind the question, not just memorizing the answer.

Confused?

- Use visual explanations to better understand how the algorithm works. + Review the correct option carefully and compare it with your + selection to understand the difference.

diff --git a/src/pages/QuizPage.jsx b/src/pages/QuizPage.jsx index 3c19346..7fcbbb7 100644 --- a/src/pages/QuizPage.jsx +++ b/src/pages/QuizPage.jsx @@ -6,7 +6,7 @@ function QuizPage() { const navigate = useNavigate(); const questions = location.state?.questions || []; - const topic = location.state?.topic || "Data Structures & Algorithms"; + const topic = location.state?.topic || "Quiz"; const quizId = location.state?.quizId || null; const [currentIndex, setCurrentIndex] = useState(0); @@ -31,10 +31,10 @@ function QuizPage() { const currentQuestion = questions[currentIndex]; const progress = ((currentIndex + 1) / questions.length) * 100; - const handleSelect = (option) => { + const handleSelect = (optionKey) => { setSelectedAnswers((prev) => ({ ...prev, - [currentIndex]: option, + [currentIndex]: optionKey, })); }; @@ -121,15 +121,14 @@ function QuizPage() {

{topic}

- Question {currentIndex + 1} of {questions.length} + + Question {currentIndex + 1} of {questions.length} + {Math.round(progress)}% Completed
-
+
@@ -145,21 +144,19 @@ function QuizPage() {
- {currentQuestion.options.map((option, index) => ( + {Object.entries(currentQuestion.options).map(([key, value]) => ( ))} @@ -176,15 +173,12 @@ function QuizPage() { {currentIndex < questions.length - 1 ? ( - ) : (
- -