Finalized the Speaking module exercise
This commit is contained in:
@@ -38,6 +38,7 @@ export default function Speaking({id, title, text, type, prompts, onNext, onBack
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("audio", audioFile, "audio.wav");
|
||||
formData.append("question", `${text.replaceAll("\n", "")} You should talk about: ${prompts.join(", ")}`);
|
||||
|
||||
const config = {
|
||||
headers: {
|
||||
@@ -51,7 +52,7 @@ export default function Speaking({id, title, text, type, prompts, onNext, onBack
|
||||
};
|
||||
|
||||
if (mediaBlob) uploadFile();
|
||||
}, [mediaBlob]);
|
||||
}, [mediaBlob, text, prompts]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-full w-full gap-9">
|
||||
@@ -200,14 +201,28 @@ export default function Speaking({id, title, text, type, prompts, onNext, onBack
|
||||
<Button
|
||||
color="green"
|
||||
variant="outline"
|
||||
onClick={() => onBack({exercise: id, solutions: [], score: {correct: 1, total: 1, missing: 0}, type})}
|
||||
onClick={() =>
|
||||
onBack({
|
||||
exercise: id,
|
||||
solutions: mediaBlob ? [{id, solution: mediaBlob}] : [],
|
||||
score: {correct: 1, total: 1, missing: 0},
|
||||
type,
|
||||
})
|
||||
}
|
||||
className="max-w-[200px] self-end w-full">
|
||||
Back
|
||||
</Button>
|
||||
<Button
|
||||
color="green"
|
||||
disabled={!mediaBlob}
|
||||
onClick={() => onNext({exercise: id, solutions: [], score: {correct: 1, total: 1, missing: 0}, type})}
|
||||
onClick={() =>
|
||||
onNext({
|
||||
exercise: id,
|
||||
solutions: mediaBlob ? [{id, solution: mediaBlob}] : [],
|
||||
score: {correct: 1, total: 1, missing: 0},
|
||||
type,
|
||||
})
|
||||
}
|
||||
className="max-w-[200px] self-end w-full">
|
||||
Next
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user