import { Card } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { StudentExamProps } from '@/types/page'; import { usePage } from '@inertiajs/react'; import { FileQuestion, CheckCircle2, XCircle } from 'lucide-react'; const ExamQuestions = () => { const { props } = usePage(); const { questions } = props; const getQuestionTypeBadge = (type: string) => { const colors: Record = { multiple_choice: 'bg-blue-600', multiple_select: 'bg-purple-600', matching: 'bg-green-600', fill_blank: 'bg-yellow-600', ordering: 'bg-orange-600', short_answer: 'bg-red-600', listening: 'bg-pink-600', }; return ( {type.replace('_', ' ').replace(/\b\w/g, (l) => l.toUpperCase())} ); }; return (
{questions && questions.length > 0 ? ( questions.map((question, index) => (
Question {index + 1} {getQuestionTypeBadge(question.question_type)} {question.marks} marks

{question.title}

{question.description && (

{question.description}

)} {question.question_options && question.question_options.length > 0 && (

Options:

    {question.question_options.map((option: any, optIndex: number) => (
  • {option.option_text || option.text || 'Option'} {option.is_correct && ( )}
  • ))}
)}
)) ) : (

No questions available for this exam yet.

)}
); }; export default ExamQuestions;