Updated the multiple choice

This commit is contained in:
Tiago Ribeiro
2024-07-27 17:43:26 +01:00
parent b5a305485f
commit fb077fd8cc

View File

@@ -1,4 +1,5 @@
import FillBlanksEdit from "@/components/Generation/fill.blanks.edit";
import MultipleChoiceEdit from "@/components/Generation/multiple.choice.edit";
import WriteBlankEdits from "@/components/Generation/write.blanks.edit";
import Input from "@/components/Low/Input";
import Select from "@/components/Low/Select";
@@ -130,12 +131,16 @@ const TaskTab = ({section, setSection}: {section: LevelSection; setSection: (sec
<span className="text-xl font-semibold">Multiple Choice</span>
<span className="rounded-xl bg-white border border-ielts-level p-1 px-4 w-fit">{exercise.questions.length} questions</span>
</div>
<span>{exercise.prompt}</span>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{exercise.questions.map((question) => (
<QuestionDisplay question={question} onUpdate={onUpdate} key={question.id} />
))}
</div>
<MultipleChoiceEdit
exercise={exercise}
key={exercise.id}
updateExercise={(data: any) =>
setSection({
...section,
part: {...section.part!, exercises: section.part!.exercises.map((x) => (x.id === exercise.id ? {...x, ...data} : x))},
})
}
/>
</div>
);
@@ -399,6 +404,12 @@ const LevelGeneration = () => {
setParts(newParts);
setGeneratedExam(exam);
})
.catch((error) => {
console.log(error);
playSound("error");
toast.error("Something went wrong, please try again later!");
})
.finally(() => setIsLoading(false));
};