diff --git a/src/components/Low/Checkbox.tsx b/src/components/Low/Checkbox.tsx
index d5a7298d..fa90951f 100644
--- a/src/components/Low/Checkbox.tsx
+++ b/src/components/Low/Checkbox.tsx
@@ -11,14 +11,16 @@ interface Props {
export default function Checkbox({isChecked, onChange, children, disabled}: Props) {
return (
-
{
- if(disabled) return;
- onChange(!isChecked);
- }}>
+
{
+ if (disabled) return;
+ onChange(!isChecked);
+ }}>
diff --git a/src/pages/(generation)/LevelGeneration.tsx b/src/pages/(generation)/LevelGeneration.tsx
index 09b1615a..480ca61a 100644
--- a/src/pages/(generation)/LevelGeneration.tsx
+++ b/src/pages/(generation)/LevelGeneration.tsx
@@ -1,6 +1,7 @@
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 Checkbox from "@/components/Low/Checkbox";
import Input from "@/components/Low/Input";
import Select from "@/components/Low/Select";
import {
@@ -234,7 +235,7 @@ interface Props {
id: string;
}
-const LevelGeneration = ({ id } : Props) => {
+const LevelGeneration = ({id}: Props) => {
const [generatedExam, setGeneratedExam] = useState
();
const [isLoading, setIsLoading] = useState(false);
const [resultingExam, setResultingExam] = useState();
@@ -242,6 +243,7 @@ const LevelGeneration = ({ id } : Props) => {
const [difficulty, setDifficulty] = useState(sample(DIFFICULTIES)!);
const [numberOfParts, setNumberOfParts] = useState(1);
const [parts, setParts] = useState([{quantity: 10, type: "multiple_choice_4"}]);
+ const [isPrivate, setPrivate] = useState(false);
useEffect(() => {
setParts((prev) => Array.from(Array(numberOfParts)).map((_, i) => (!!prev.at(i) ? prev.at(i)! : {quantity: 10, type: "multiple_choice_4"})));
@@ -301,6 +303,7 @@ const LevelGeneration = ({ id } : Props) => {
difficulty,
variant: "full",
isDiagnostic: false,
+ private: isPrivate,
parts: parts
.map((part, index) => {
const currentExercise = result.data.exercises[`exercise_${index + 1}`] as any;
@@ -424,7 +427,7 @@ const LevelGeneration = ({ id } : Props) => {
return;
}
- if(!id) {
+ if (!id) {
toast.error("Please insert a title before submitting");
return;
}
@@ -456,8 +459,8 @@ const LevelGeneration = ({ id } : Props) => {
return (
<>
-
-
+
+
-
+
setNumberOfParts(parseInt(v))} value={numberOfParts} />
-
+
setTimer(parseInt(v))} value={timer} />
+
+
+
+ Privacy (Only available for Assignments)
+
+
diff --git a/src/pages/(generation)/ListeningGeneration.tsx b/src/pages/(generation)/ListeningGeneration.tsx
index 5388b183..ef17c4ca 100644
--- a/src/pages/(generation)/ListeningGeneration.tsx
+++ b/src/pages/(generation)/ListeningGeneration.tsx
@@ -16,6 +16,7 @@ import {BsArrowRepeat, BsCheck} from "react-icons/bs";
import {toast} from "react-toastify";
import WriteBlanksEdit from "@/components/Generation/write.blanks.edit";
import {generate} from "random-words";
+import Checkbox from "@/components/Low/Checkbox";
const DIFFICULTIES: Difficulty[] = ["easy", "medium", "hard"];
@@ -232,7 +233,7 @@ interface Props {
id: string;
}
-const ListeningGeneration = ({ id } : Props) => {
+const ListeningGeneration = ({id}: Props) => {
const [part1, setPart1] = useState();
const [part2, setPart2] = useState();
const [part3, setPart3] = useState();
@@ -241,6 +242,7 @@ const ListeningGeneration = ({ id } : Props) => {
const [isLoading, setIsLoading] = useState(false);
const [resultingExam, setResultingExam] = useState();
const [difficulty, setDifficulty] = useState(sample(DIFFICULTIES)!);
+ const [isPrivate, setPrivate] = useState(false);
useEffect(() => {
const part1Timer = part1 ? 5 : 0;
@@ -262,11 +264,11 @@ const ListeningGeneration = ({ id } : Props) => {
console.log({parts});
if (parts.length === 0) return toast.error("Please generate at least one section!");
- if(!id) {
+ if (!id) {
toast.error("Please insert a title before submitting");
return;
}
-
+
setIsLoading(true);
axios
@@ -275,6 +277,7 @@ const ListeningGeneration = ({ id } : Props) => {
parts,
minTimer,
difficulty,
+ private: isPrivate,
})
.then((result) => {
playSound("sent");
@@ -313,7 +316,7 @@ const ListeningGeneration = ({ id } : Props) => {
return (
<>
-
+
{
className="max-w-[300px]"
/>
-
+
+
+
+
+ Privacy (Only available for Assignments)
+
+
diff --git a/src/pages/(generation)/ReadingGeneration.tsx b/src/pages/(generation)/ReadingGeneration.tsx
index 6bd81dde..51019a71 100644
--- a/src/pages/(generation)/ReadingGeneration.tsx
+++ b/src/pages/(generation)/ReadingGeneration.tsx
@@ -20,6 +20,7 @@ import TrueFalseEdit from "@/components/Generation/true.false.edit";
import WriteBlanksEdit from "@/components/Generation/write.blanks.edit";
import MatchSentencesEdit from "@/components/Generation/match.sentences.edit";
import MultipleChoiceEdit from "@/components/Generation/multiple.choice.edit";
+import Checkbox from "@/components/Low/Checkbox";
const DIFFICULTIES: Difficulty[] = ["easy", "medium", "hard"];
@@ -262,7 +263,7 @@ interface Props {
id: string;
}
-const ReadingGeneration = ({ id } : Props) => {
+const ReadingGeneration = ({id}: Props) => {
const [part1, setPart1] = useState();
const [part2, setPart2] = useState();
const [part3, setPart3] = useState();
@@ -270,6 +271,7 @@ const ReadingGeneration = ({ id } : Props) => {
const [isLoading, setIsLoading] = useState(false);
const [resultingExam, setResultingExam] = useState();
const [difficulty, setDifficulty] = useState(sample(DIFFICULTIES)!);
+ const [isPrivate, setPrivate] = useState(false);
useEffect(() => {
const parts = [part1, part2, part3].filter((x) => !!x);
@@ -304,7 +306,7 @@ const ReadingGeneration = ({ id } : Props) => {
return;
}
- if(!id) {
+ if (!id) {
toast.error("Please insert a title before submitting");
return;
}
@@ -319,6 +321,7 @@ const ReadingGeneration = ({ id } : Props) => {
type: "academic",
variant: parts.length === 3 ? "full" : "partial",
difficulty,
+ private: isPrivate,
};
axios
@@ -344,7 +347,7 @@ const ReadingGeneration = ({ id } : Props) => {
return (
<>
-
+
{
className="max-w-[300px]"
/>
-
+
+
+
+
+ Privacy (Only available for Assignments)
+
+
diff --git a/src/pages/(generation)/SpeakingGeneration.tsx b/src/pages/(generation)/SpeakingGeneration.tsx
index c4959f6c..28aaa8a2 100644
--- a/src/pages/(generation)/SpeakingGeneration.tsx
+++ b/src/pages/(generation)/SpeakingGeneration.tsx
@@ -1,3 +1,4 @@
+import Checkbox from "@/components/Low/Checkbox";
import Input from "@/components/Low/Input";
import Select from "@/components/Low/Select";
import {Difficulty, Exercise, InteractiveSpeakingExercise, SpeakingExam, SpeakingExercise} from "@/interfaces/exam";
@@ -225,7 +226,7 @@ interface Props {
id: string;
}
-const SpeakingGeneration = ({ id } : Props) => {
+const SpeakingGeneration = ({id}: Props) => {
const [part1, setPart1] = useState();
const [part2, setPart2] = useState();
const [part3, setPart3] = useState();
@@ -233,6 +234,7 @@ const SpeakingGeneration = ({ id } : Props) => {
const [isLoading, setIsLoading] = useState(false);
const [resultingExam, setResultingExam] = useState();
const [difficulty, setDifficulty] = useState(sample(DIFFICULTIES)!);
+ const [isPrivate, setPrivate] = useState(false);
useEffect(() => {
const parts = [part1, part2, part3].filter((x) => !!x);
@@ -247,11 +249,11 @@ const SpeakingGeneration = ({ id } : Props) => {
const submitExam = () => {
if (!part1?.result && !part2?.result && !part3?.result) return toast.error("Please generate at least one task!");
- if(!id) {
+ if (!id) {
toast.error("Please insert a title before submitting");
return;
}
-
+
setIsLoading(true);
const genders = [part1?.gender, part2?.gender, part3?.gender].filter((x) => !!x);
@@ -272,6 +274,7 @@ const SpeakingGeneration = ({ id } : Props) => {
variant: minTimer >= 14 ? "full" : "partial",
module: "speaking",
instructorGender: genders.every((x) => x === "male") ? "male" : genders.every((x) => x === "female") ? "female" : "varied",
+ private: isPrivate,
};
axios
@@ -313,7 +316,7 @@ const SpeakingGeneration = ({ id } : Props) => {
return (
<>
-
+
{
className="max-w-[300px]"
/>
-
+
+
+
+
+
+ Privacy (Only available for Assignments)
+
+
diff --git a/src/pages/(generation)/WritingGeneration.tsx b/src/pages/(generation)/WritingGeneration.tsx
index be4e12cd..84115b00 100644
--- a/src/pages/(generation)/WritingGeneration.tsx
+++ b/src/pages/(generation)/WritingGeneration.tsx
@@ -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();
const [task2, setTask2] = useState();
const [minTimer, setMinTimer] = useState(60);
const [isLoading, setIsLoading] = useState(false);
const [resultingExam, setResultingExam] = useState();
const [difficulty, setDifficulty] = useState(sample(DIFFICULTIES)!);
+ const [isPrivate, setPrivate] = useState(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 (
<>
-
+
{
className="max-w-[300px]"
/>
-
+
+
+
+
+
+ Privacy (Only available for Assignments)
+
+