import React, { useState, useEffect } from 'react' import QuestionPanel from './QuestionPanel' import SidebarPanel from './SidebarPanel' import { Clock, X } from 'lucide-react' export default function ExamInterface({ examType, questions, onEndExam }) { const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0) const [timeRemaining, setTimeRemaining] = useState(getBlockTime(examType)) const [answers, setAnswers] = useState({}) const [markedForReview, setMarkedForReview] = useState(new Set()) const [contrast, setContrast] = useState(100) const [showSettings, setShowSettings] = useState(false) function getBlockTime(type) { return type === 'step1' ? 30 * 60 : 40 * 60 } useEffect(() => { const timer = setInterval(() => { setTimeRemaining(prev => { if (prev <= 0) { clearInterval(timer) return 0 } return prev - 1 }) }, 1000) return () => clearInterval(timer) }, []) const handleAnswerSelect = (option) => { setAnswers({ ...answers, [currentQuestionIndex]: option }) } const handleMarkForReview = () => { const newSet = new Set(markedForReview) if (newSet.has(currentQuestionIndex)) { newSet.delete(currentQuestionIndex) } else { newSet.add(currentQuestionIndex) } setMarkedForReview(newSet) } const goToQuestion = (index) => { setCurrentQuestionIndex(index) } const goToPrevious = () => { if (currentQuestionIndex > 0) { setCurrentQuestionIndex(currentQuestionIndex - 1) } } const goToNext = () => { if (currentQuestionIndex < questions.length - 1) { setCurrentQuestionIndex(currentQuestionIndex + 1) } } const formatTime = (seconds) => { const mins = Math.floor(seconds / 60) const secs = seconds % 60 return `${mins}:${secs.toString().padStart(2, '0')}` } const currentQuestion = questions[currentQuestionIndex] const isAnswered = answers.hasOwnProperty(currentQuestionIndex) const isMarked = markedForReview.has(currentQuestionIndex) const answeredCount = Object.keys(answers).length const markedCount = markedForReview.size return (
{/* Header */}

USMLE {examType.toUpperCase()} Exam

Block {Math.floor(currentQuestionIndex / 20) + 1} of {Math.ceil(questions.length / 20)}

Time Remaining
{formatTime(timeRemaining)}
{/* Main Content */}
0} canGoNext={currentQuestionIndex < questions.length - 1} contrast={contrast} />
) }