Removed the ability to pause the listening

This commit is contained in:
Tiago Ribeiro
2023-09-13 07:40:20 +01:00
parent 8cbf56b81a
commit 8dcfb8a670
2 changed files with 5 additions and 3 deletions

View File

@@ -11,9 +11,10 @@ interface Props {
autoPlay?: boolean;
disabled?: boolean;
onEnd?: () => void;
disablePause?: boolean;
}
export default function AudioPlayer({src, color, autoPlay = false, disabled = false, onEnd}: Props) {
export default function AudioPlayer({src, color, autoPlay = false, disabled = false, onEnd, disablePause = false}: Props) {
const [isPlaying, setIsPlaying] = useState(false);
const [duration, setDuration] = useState(0);
const [currentTime, setCurrentTime] = useState(0);
@@ -62,8 +63,8 @@ export default function AudioPlayer({src, color, autoPlay = false, disabled = fa
<div className="w-full h-fit flex gap-4 items-center mt-2">
{isPlaying && (
<BsPauseFill
className={clsx("text-mti-gray-cool cursor-pointer w-5 h-5", disabled && "opacity-60 cursor-not-allowed")}
onClick={disabled ? undefined : togglePlayPause}
className={clsx("text-mti-gray-cool cursor-pointer w-5 h-5", (disabled || disablePause) && "opacity-60 cursor-not-allowed")}
onClick={disabled || disablePause ? undefined : togglePlayPause}
/>
)}
{!isPlaying && (

View File

@@ -107,6 +107,7 @@ export default function Listening({exam, showSolutions = false, onFinish}: Props
color="listening"
onEnd={() => setTimesListened((prev) => prev + 1)}
disabled={timesListened === exam.audio.repeatableTimes}
disablePause
/>
</div>
</div>