Added Match Sentences to Reading Generation

This commit is contained in:
Joao Ramos
2024-07-07 16:43:14 +01:00
parent 903a567805
commit 0c5c024098
3 changed files with 159 additions and 10 deletions

View File

@@ -22,6 +22,7 @@ import { v4 } from "uuid";
import FillBlanksEdit from "@/components/Generation/fill.blanks.edit";
import TrueFalseEdit from "@/components/Generation/true.false.edit";
import WriteBlanksEdit from "@/components/Generation/write.blanks.edit";
import MatchSentencesEdit from "@/components/Generation/match.sentences.edit";
const DIFFICULTIES: Difficulty[] = ["easy", "medium", "hard"];
@@ -148,7 +149,30 @@ const PartTab = ({
/>
</>
);
// TODO: case "matchSentences": There seems to be an issue with the API
case "matchSentences":
return (
<>
<h1>Exercise: Match Sentences</h1>
<MatchSentencesEdit
exercise={exercise}
key={exercise.id}
updateExercise={(data: any) => {
updatePart((part?: ReadingPart) => {
if (part) {
return {
...part,
exercises: part.exercises.map((x) =>
x.id === exercise.id ? { ...x, ...data } : x
),
} as ReadingPart;
}
return part;
});
}}
/>
</>
);
default:
return null;
}
@@ -246,7 +270,7 @@ const ReadingGeneration = () => {
{ type: "fillBlanks", label: "Fill the Blanks" },
{ type: "trueFalse", label: "True or False" },
{ type: "writeBlanks", label: "Write the Blanks" },
{ type: "matchSentences", label: "Match Sentences" },
{ type: "paragraphMatch", label: "Match Sentences" },
];
const toggleType = (type: string) =>