Exam generation rework, batch user tables, fastapi endpoint switch
This commit is contained in:
41
src/components/Popouts/Exam.tsx
Normal file
41
src/components/Popouts/Exam.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import Level from "@/exams/Level";
|
||||
import Reading from "@/exams/Reading";
|
||||
import Writing from "@/exams/Writing";
|
||||
import { usePersistentStorage } from "@/hooks/usePersistentStorage";
|
||||
import { LevelExam, ReadingExam, WritingExam } from "@/interfaces/exam";
|
||||
import { User } from "@/interfaces/user";
|
||||
import { usePersistentExamStore } from "@/stores/examStore";
|
||||
import clsx from "clsx";
|
||||
|
||||
// todo: perms
|
||||
|
||||
const Popout: React.FC<{ user: User }> = ({ user }) => {
|
||||
const state = usePersistentExamStore((state) => state);
|
||||
usePersistentStorage(usePersistentExamStore);
|
||||
return (
|
||||
<div className={`relative flex w-full min-h-screen p-4 shadow-md items-center rounded-2xl ${state.bgColor}`}>
|
||||
<div className={clsx("relative flex p-20 justify-center flex-1")}>
|
||||
{state.exam?.module == "level" && state.exam.parts && state.partIndex >= 0 &&
|
||||
<Level exam={state.exam as LevelExam} onFinish={() => {
|
||||
state.setPartIndex(0);
|
||||
state.setExerciseIndex(0);
|
||||
state.setQuestionIndex(0);
|
||||
}} showSolutions={true} preview={true} />
|
||||
}
|
||||
{state.exam?.module == "writing" && state.exam.exercises && state.partIndex >= 0 &&
|
||||
<Writing exam={state.exam as WritingExam} onFinish={() => {
|
||||
state.setExerciseIndex(0);
|
||||
}} preview={true} />
|
||||
}
|
||||
{state.exam?.module == "reading" && state.exam.parts.length > 0 &&
|
||||
<Reading exam={state.exam as ReadingExam} onFinish={() => {
|
||||
state.setPartIndex(0);
|
||||
state.setExerciseIndex(-1);
|
||||
state.setQuestionIndex(0);
|
||||
}} preview={true} />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default Popout;
|
||||
Reference in New Issue
Block a user