diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-05-29 19:02:47 +0200 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-05-29 19:02:47 +0200 |
commit | df24116c3da3a6455abb332ec45280dcb226ca92 (patch) | |
tree | 906ce8ab9b7ef576dd3c87d38414ab2098613124 | |
parent | 153aedeb78c605bb73cca7e45aa5a1245292d85e (diff) |
feat: add extra guards to player time indicators
-rw-r--r-- | src/frontend/tubo/player/views.cljs | 4 | ||||
-rw-r--r-- | src/frontend/tubo/queue/views.cljs | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/frontend/tubo/player/views.cljs b/src/frontend/tubo/player/views.cljs index 4fc7994..9196348 100644 --- a/src/frontend/tubo/player/views.cljs +++ b/src/frontend/tubo/player/views.cljs @@ -91,11 +91,11 @@ :disabled? (not (and queue (< (inc queue-pos) (count queue))))]] [:div.hidden.lg:flex.items-center.text-sm [:span.mx-2 - (if @!elapsed-time (utils/format-duration @!elapsed-time) "--:--")] + (if (and @!player @!elapsed-time) (utils/format-duration @!elapsed-time) "--:--")] [:div.w-20.lg:w-64.mx-2.flex.items-center [player/time-slider !player !elapsed-time color]] [:span.mx-2 - (if player-ready? (utils/format-duration (.-duration @!player)) "--:--")]]])) + (if (and @!player player-ready?) (utils/format-duration (.-duration @!player)) "--:--")]]])) (defn extra-controls [!player {:keys [url uploader-url] :as stream} color] diff --git a/src/frontend/tubo/queue/views.cljs b/src/frontend/tubo/queue/views.cljs index d519da7..1ed032c 100644 --- a/src/frontend/tubo/queue/views.cljs +++ b/src/frontend/tubo/queue/views.cljs @@ -87,9 +87,11 @@ queue-pos @(rf/subscribe [:queue-pos])] [:<> [:div.flex.flex-auto.py-2.w-full.items-center.text-sm - [:span.mr-4 (if @!elapsed-time (utils/format-duration @!elapsed-time) "--:--")] + [:span.mr-4.whitespace-nowrap + (if (and @!player @!elapsed-time) (utils/format-duration @!elapsed-time) "--:--")] [player/time-slider !player !elapsed-time service-color] - [:span.ml-4 (if player-ready? (utils/format-duration (.-duration @!player)) "--:--")]] + [:span.ml-4.whitespace-nowrap + (if (and @!player player-ready?) (utils/format-duration (.-duration @!player)) "--:--")]] [:div.flex.justify-center.items-center [player/loop-button loop-playback service-color true] [player/button |