From 60e858c931a07318faf461b98a3c99475fe59d5e Mon Sep 17 00:00:00 2001 From: shafin-r Date: Sun, 1 Feb 2026 17:10:38 +0600 Subject: [PATCH] feat(test); add strikethrough functionality for mcq options --- src/pages/student/practice/Test.tsx | 77 ++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/src/pages/student/practice/Test.tsx b/src/pages/student/practice/Test.tsx index c0924f3..3f0f3db 100644 --- a/src/pages/student/practice/Test.tsx +++ b/src/pages/student/practice/Test.tsx @@ -41,6 +41,7 @@ import { useExamNavigationGuard } from "../../../hooks/useExamNavGuard"; export const Test = () => { const blocker = useExamNavigationGuard(); + const [eliminated, setEliminated] = useState>>({}); const [showExitDialog, setShowExitDialog] = useState(false); @@ -223,37 +224,61 @@ export const Test = () => { // ✅ MCQ if (question.options && question.options.length > 0) { + const eliminatedSet = eliminated[question.id] ?? new Set(); return (
{question.options.map((option, index) => { const isSelected = currentAnswer === option.id; + const isEliminated = eliminatedSet.has(option.id); return ( - + ✕ + + +
); })} @@ -278,6 +303,14 @@ export const Test = () => { ); }; + const toggleEliminate = (questionId: string, optionId: string) => { + setEliminated((prev) => { + const current = new Set(prev[questionId] ?? []); + current.has(optionId) ? current.delete(optionId) : current.add(optionId); + return { ...prev, [questionId]: current }; + }); + }; + switch (phase) { case "IDLE": return (