Updated the generation to allow for private exams
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import Checkbox from "@/components/Low/Checkbox";
|
||||
import Input from "@/components/Low/Input";
|
||||
import Select from "@/components/Low/Select";
|
||||
import {Difficulty, WritingExam, WritingExercise} from "@/interfaces/exam";
|
||||
@@ -79,13 +80,14 @@ interface Props {
|
||||
id: string;
|
||||
}
|
||||
|
||||
const WritingGeneration = ({ id } : Props) => {
|
||||
const WritingGeneration = ({id}: Props) => {
|
||||
const [task1, setTask1] = useState<string>();
|
||||
const [task2, setTask2] = useState<string>();
|
||||
const [minTimer, setMinTimer] = useState(60);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [resultingExam, setResultingExam] = useState<WritingExam>();
|
||||
const [difficulty, setDifficulty] = useState<Difficulty>(sample(DIFFICULTIES)!);
|
||||
const [isPrivate, setPrivate] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
const task1Timer = task1 ? 20 : 0;
|
||||
@@ -120,7 +122,7 @@ const WritingGeneration = ({ id } : Props) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!id) {
|
||||
if (!id) {
|
||||
toast.error("Please insert a title before submitting");
|
||||
return;
|
||||
}
|
||||
@@ -164,6 +166,7 @@ const WritingGeneration = ({ id } : Props) => {
|
||||
id,
|
||||
variant: exercise1 && exercise2 ? "full" : "partial",
|
||||
difficulty,
|
||||
private: isPrivate,
|
||||
};
|
||||
|
||||
axios
|
||||
@@ -188,7 +191,7 @@ const WritingGeneration = ({ id } : Props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex gap-4 w-1/2">
|
||||
<div className="flex gap-4 w-full items-center">
|
||||
<div className="flex flex-col gap-3">
|
||||
<label className="font-normal text-base text-mti-gray-dim">Timer</label>
|
||||
<Input
|
||||
@@ -199,7 +202,7 @@ const WritingGeneration = ({ id } : Props) => {
|
||||
className="max-w-[300px]"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col gap-3 w-full">
|
||||
<div className="flex flex-col gap-3 w-1/2">
|
||||
<label className="font-normal text-base text-mti-gray-dim">Difficulty</label>
|
||||
<Select
|
||||
options={DIFFICULTIES.map((x) => ({value: x, label: capitalize(x)}))}
|
||||
@@ -208,6 +211,13 @@ const WritingGeneration = ({ id } : Props) => {
|
||||
disabled={!!task1 || !!task2}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-3 w-fit h-fit">
|
||||
<div className="h-6" />
|
||||
<Checkbox isChecked={isPrivate} onChange={setPrivate}>
|
||||
Privacy (Only available for Assignments)
|
||||
</Checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Tab.Group>
|
||||
|
||||
Reference in New Issue
Block a user