diff --git a/src/css/components/Shape.scss b/src/css/components/Shape.scss index cb895ad87..6b1d75cff 100644 --- a/src/css/components/Shape.scss +++ b/src/css/components/Shape.scss @@ -36,3 +36,45 @@ left: 1.5px; } } + +.loading { + display: inline-block; + position: relative; + width: 4px; + height: 4px; + right: 38px; + + div { + display: inline-block; + position: absolute; + left: 8px; + width: 6px; + animation: loading 0.8s cubic-bezier(0, 0.5, 0.5, 1) infinite; + } + + div:nth-child(1) { + left: 12px; + animation-delay: -0.24s; + } + + div:nth-child(2) { + left: 20px; + animation-delay: -0.12s; + } + + div:nth-child(3) { + left: 28px; + animation-delay: 0; + } +} + +@keyframes loading { + 0% { + top: 4px; + height: 8px; + } + 50%, 100% { + top: 8px; + height: 4px; + } +} diff --git a/src/css/themes/leaf/pages/surah/_stream.scss b/src/css/themes/leaf/pages/surah/_stream.scss index ad2607780..4a8029801 100644 --- a/src/css/themes/leaf/pages/surah/_stream.scss +++ b/src/css/themes/leaf/pages/surah/_stream.scss @@ -32,4 +32,8 @@ background: unset; fill: $green; } + + .row .loading div { + background: $green; + } } diff --git a/src/css/themes/moon/pages/surah/_stream.scss b/src/css/themes/moon/pages/surah/_stream.scss index 82ef04a32..0d1309760 100644 --- a/src/css/themes/moon/pages/surah/_stream.scss +++ b/src/css/themes/moon/pages/surah/_stream.scss @@ -39,4 +39,8 @@ stroke-width: 5; } } + + .row .loading div { + background: $gold; + } } diff --git a/src/js/components/Shape.tsx b/src/js/components/Shape.tsx index 39c9ffa8e..1c4168c32 100644 --- a/src/js/components/Shape.tsx +++ b/src/js/components/Shape.tsx @@ -134,3 +134,13 @@ export function RefreshShape({ onClick }: Props) { ); } + +export function LoadingShape() { + return ( +
+
+
+
+
+ ); +} diff --git a/src/js/components/Timer.tsx b/src/js/components/Timer.tsx index 95aea4c71..ce3055a66 100644 --- a/src/js/components/Timer.tsx +++ b/src/js/components/Timer.tsx @@ -42,7 +42,7 @@ export function Timer({ const tid = setTimeout(() => setMs(ms - 100), 100); return () => clearTimeout(tid); } - }, [isStalled, isPaused, soundOn, ms]); + }, [soundOn, isStalled, isPaused, ms]); return
{formatNumber(ms / 1000, locale)}
; } diff --git a/src/js/pages/surah/stream.tsx b/src/js/pages/surah/stream.tsx index 249722d63..0748fd0b6 100644 --- a/src/js/pages/surah/stream.tsx +++ b/src/js/pages/surah/stream.tsx @@ -13,6 +13,7 @@ import { SoundOnShape, SoundOffShape, RefreshShape, + LoadingShape, } from "components/Shape"; import * as Quran from "lib/Quran"; import { Slice } from "lib/Quran/Slice"; @@ -179,6 +180,11 @@ function SurahStream({ node, reciters, locale, slice, paused, t }: Props) { )} {readyToRender && endOfStream && setStream([])} />} + {readyToRender && soundOn && isStalled && ( +
+ +
+ )} {readyToRender && soundOn && (