From fce327a72558b41ce6a7303b38c804bfada694a1 Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Thu, 29 Dec 2022 23:03:32 +0100 Subject: feat(frontend): Modularize related streams and add responsive styles --- src/frontend/tau/components/items.cljs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/frontend/tau/components/items.cljs') diff --git a/src/frontend/tau/components/items.cljs b/src/frontend/tau/components/items.cljs index 0a8bad6..fdff1ab 100644 --- a/src/frontend/tau/components/items.cljs +++ b/src/frontend/tau/components/items.cljs @@ -1,6 +1,8 @@ (ns tau.components.items (:require + [re-frame.core :as rf] [reitit.frontend.easy :as rfe] + [tau.components.loading :as loading] [tau.util :as util] ["timeago.js" :as timeago])) @@ -78,3 +80,21 @@ [:div.flex.items-center [:i.fa-solid.fa-video.text-xs] [:p.mx-2 stream-count]]]]]) + +(defn related-streams + [related-streams next-page-url] + (let [service-color @(rf/subscribe [:service-color]) + pagination-loading? @(rf/subscribe [:show-pagination-loading])] + [:div.flex.flex-col.justify-center.items-center.flex-auto + (if (empty? related-streams) + [:div + [:p "No available streams"]] + [:div.flex.justify-center.flex-wrap + (for [[i item] (map-indexed vector related-streams) + :let [keyed-item (assoc item :key i)]] + (case (:type item) + "stream" [stream-item keyed-item] + "channel" [channel-item keyed-item] + "playlist" [playlist-item keyed-item]))]) + (when-not (empty? next-page-url) + [loading/items-pagination-loading-icon service-color pagination-loading?])])) -- cgit v1.2.3