import { Button } from '@/components/ui/button'; import { Checkbox } from '@/components/ui/checkbox'; import { Label } from '@/components/ui/label'; interface Props { question: ExamQuestion; answer: any; onAnswerChange: (answer: any) => void; } const MultipleSelectQuestion = ({ question, answer, onAnswerChange }: Props) => { const selectedOptions = answer?.selected_option_ids || []; const handleChange = (optionId: number, checked: boolean) => { const newSelectedOptions = checked ? [...selectedOptions, optionId] : selectedOptions.filter((id: number) => id !== optionId); onAnswerChange({ selected_option_ids: newSelectedOptions, }); }; const handleSelectAll = () => { const allOptionIds = question.question_options?.map((opt) => opt.id) || []; onAnswerChange({ selected_option_ids: allOptionIds, }); }; const handleClearAll = () => { onAnswerChange({ selected_option_ids: [], }); }; return (
Select all correct answers:
Selected: {selectedOptions.length} option(s)
)}