Spaces:
Running
Running
File size: 1,676 Bytes
9398f44 a17d02d 9398f44 a17d02d 9e2df12 a17d02d 9398f44 a17d02d 9398f44 a17d02d 9398f44 a17d02d 9398f44 a17d02d 9398f44 a17d02d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | import QuestionMetaBar from './QuestionMetaBar'
import QuestionBody from './QuestionBody'
import McqOptions from './McqOptions'
import MsqOptions from './MsqOptions'
import NatInput from './NatInput'
import QuestionFooter from './QuestionFooter'
export default function QuestionView({
answers,
clearResponse,
commitNAT,
current,
markAndNext,
natInput,
question,
questions,
saveAndNext,
setCurrent,
setMCQ,
setNatInput,
toggleMSQ,
}) {
return (
<div className="flex-1 flex flex-col overflow-hidden">
<QuestionMetaBar question={question} />
<div className="flex-1 overflow-y-auto p-4">
<p className="text-sm font-semibold mb-3 text-foreground">
Question No. {current + 1}
</p>
<QuestionBody question={question} />
{question.question_type === 'mcq' && (
<McqOptions
question={question}
selectedLetter={answers[question.id]}
onSelect={setMCQ}
/>
)}
{question.question_type === 'msq' && (
<MsqOptions
question={question}
selectedLetters={answers[question.id] || ''}
onToggle={toggleMSQ}
/>
)}
{question.question_type === 'nat' && (
<NatInput
value={natInput}
onChange={setNatInput}
onCommit={commitNAT}
savedValue={answers[question.id]}
/>
)}
</div>
<QuestionFooter
current={current}
setCurrent={setCurrent}
markAndNext={markAndNext}
clearResponse={clearResponse}
saveAndNext={saveAndNext}
/>
</div>
)
}
|