Added write the blanks for Listening

This commit is contained in:
Joao Ramos
2024-07-04 01:23:59 +01:00
parent e5e4e87752
commit 6d62500596

View File

@@ -14,6 +14,7 @@ import { useRouter } from "next/router";
import { useEffect, useState, Dispatch, SetStateAction } from "react"; import { useEffect, useState, Dispatch, SetStateAction } from "react";
import { BsArrowRepeat, BsCheck } from "react-icons/bs"; import { BsArrowRepeat, BsCheck } from "react-icons/bs";
import { toast } from "react-toastify"; import { toast } from "react-toastify";
import WriteBlanksEdit from "@/components/Generation/write.blanks.edit";
const DIFFICULTIES: Difficulty[] = ["easy", "medium", "hard"]; const DIFFICULTIES: Difficulty[] = ["easy", "medium", "hard"];
@@ -91,6 +92,29 @@ const PartTab = ({
} }
/> />
</> </>
);
// TODO: This might be broken as they all returns the same
case "writeBlanks":
return (
<>
<h1>Exercise: Write Blanks</h1>
<WriteBlanksEdit
exercise={exercise}
key={exercise.id}
updateExercise={(data: any) => {
updatePart((part?: ListeningPart) => {
if (part) {
return {
...part,
exercises: part.exercises.map((x) =>
x.id === exercise.id ? { ...x, ...data } : x
),
} as ListeningPart;
}
});
}}
/>
</>
); );
default: default:
return null; return null;