From 5e1b9ce2c709f0c52a40e40c52dcd8311898c4ea Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Sat, 7 Oct 2023 10:17:09 +0100 Subject: [PATCH] Updated the Speaking exam to work with always having video --- src/components/Exercises/Speaking.tsx | 53 ++++++++++++++++----------- src/exams/Speaking.tsx | 2 + src/interfaces/exam.ts | 1 + 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/components/Exercises/Speaking.tsx b/src/components/Exercises/Speaking.tsx index 7049bd16..03c79fd0 100644 --- a/src/components/Exercises/Speaking.tsx +++ b/src/components/Exercises/Speaking.tsx @@ -11,7 +11,7 @@ const ReactMediaRecorder = dynamic(() => import("react-media-recorder").then((mo ssr: false, }); -export default function Speaking({id, title, text, type, prompts, onNext, onBack}: SpeakingExercise & CommonProps) { +export default function Speaking({id, title, text, video_url, type, prompts, onNext, onBack}: SpeakingExercise & CommonProps) { const [recordingDuration, setRecordingDuration] = useState(0); const [isRecording, setIsRecording] = useState(false); const [mediaBlob, setMediaBlob] = useState(); @@ -45,30 +45,41 @@ export default function Speaking({id, title, text, type, prompts, onNext, onBack return (
-
+
{title} - - {text.split("\\n").map((line, index) => ( - - {line} -
-
- ))} -
-
- {prompts && prompts.length > 0 && ( -
- You should talk about the following things: -
- {prompts.map((x, index) => ( -
  • - {x} -
  • + {!video_url && ( + + {text.split("\\n").map((line, index) => ( + + {line} +
    +
    ))} +
    + )} +
    +
    + {video_url && ( +
    +
    -
    - )} + )} + {prompts && prompts.length > 0 && ( +
    + You should talk about the following things: +
    + {prompts.map((x, index) => ( +
  • + {x} +
  • + ))} +
    +
    + )} +