From df24116c3da3a6455abb332ec45280dcb226ca92 Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Wed, 29 May 2024 19:02:47 +0200 Subject: feat: add extra guards to player time indicators --- src/frontend/tubo/player/views.cljs | 4 ++-- src/frontend/tubo/queue/views.cljs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit v1.2.3