Fixed some more issues with the Speaking

This commit is contained in:
Tiago Ribeiro
2024-06-18 22:16:31 +01:00
parent cb49e15cb0
commit 53dbf99fba
3 changed files with 15 additions and 8 deletions

View File

@@ -60,13 +60,16 @@ export default function InteractiveSpeaking({
setIsLoading(true);
const answer = await saveAnswer(questionIndex);
console.log(questionIndex + 1 < prompts.length, questionIndex, prompts.length);
if (questionIndex + 1 < prompts.length) {
setQuestionIndex(questionIndex + 1);
setIsLoading(false);
return;
}
setIsLoading(false);
setQuestionIndex(0);
onNext({
exercise: id,

View File

@@ -95,7 +95,7 @@ export default function Speaking({id, title, text, video_url, type, prompts, suf
return (
<div className="flex flex-col h-full w-full gap-9">
<Modal className="!w-96 aspect-square" isOpen={isPromptsModalOpen} onClose={() => setIsPromptsModalOpen(false)}>
<Modal title="Prompts" className="!w-96 aspect-square" isOpen={isPromptsModalOpen} onClose={() => setIsPromptsModalOpen(false)}>
<div className="flex flex-col items-center justify-center gap-4 w-full h-full">
<div className="flex flex-col gap-1 ml-4">
{prompts.map((x, index) => (
@@ -126,7 +126,7 @@ export default function Speaking({id, title, text, video_url, type, prompts, suf
</span>
)}
</div>
<div className="flex gap-6 items-center">
<div className="flex flex-col gap-6 items-center">
{video_url && (
<div className="flex flex-col gap-4 w-full items-center">
<video key={id} autoPlay controls className="max-w-3xl rounded-xl">
@@ -134,11 +134,7 @@ export default function Speaking({id, title, text, video_url, type, prompts, suf
</video>
</div>
)}
{prompts && prompts.length > 0 && (
<div className="w-full aspect-square bg-white shadow rounded-xl flex items-center justify-center">
<Button onClick={() => setIsPromptsModalOpen(true)}>View Prompts</Button>
</div>
)}
{prompts && prompts.length > 0 && <Button onClick={() => setIsPromptsModalOpen(true)}>View Prompts</Button>}
</div>
</div>