diff --git a/src/css/components/Icon.scss b/src/css/components/Icon.scss index 1d49cd1..49b4235 100644 --- a/src/css/components/Icon.scss +++ b/src/css/components/Icon.scss @@ -29,7 +29,6 @@ display: inline-block; position: relative; left: 30px; - top: 10px; height: 4px; div { diff --git a/src/js/components/Timer.tsx b/src/js/components/Timer.tsx index 09d1b91..00e93d2 100644 --- a/src/js/components/Timer.tsx +++ b/src/js/components/Timer.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect } from "react"; import * as Quran from "lib/Quran"; import { formatNumber } from "lib/i18n"; @@ -9,6 +9,8 @@ interface Props { soundOn: boolean; setStream: (stream: Quran.Ayat) => void; setEndOfStream: (v: boolean) => void; + ms: number | null; + setMs: (n: number) => void; isPaused: boolean; isStalled: boolean; } @@ -22,10 +24,11 @@ export function Timer({ setEndOfStream, locale, isPaused, + ms, + setMs, }: Props) { const ayah = stream[stream.length - 1]; const lastAyah = surah.ayat[surah.ayat.length - 1]; - const [ms, setMs] = useState(ayah.readTimeMs); useEffect(() => { setMs(ayah.readTimeMs); diff --git a/src/js/pages/SurahStream.tsx b/src/js/pages/SurahStream.tsx index 243eb75..0143676 100644 --- a/src/js/pages/SurahStream.tsx +++ b/src/js/pages/SurahStream.tsx @@ -39,6 +39,7 @@ function SurahStream({ node, recitations, locale, paused, t }: Props) { ); const readyToRender = stream.length > 0; const ayah = stream[stream.length - 1]; + const [ms, setMs] = useState(null); const ref = useRef(); useEffect(() => { @@ -53,6 +54,12 @@ function SurahStream({ node, recitations, locale, paused, t }: Props) { setStream([surah.ayat[0]]); }, [stream.length === 0]); + useEffect(() => { + if (ayah) { + setMs(ayah.readTimeMs); + } + }, [ayah]); + return (
setIsPaused(true)} /> )} {readyToRender && !endOfStream && ( -
+
)} {readyToRender && soundOn && isStalled && }