aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/tau/components/items.cljs
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-29 23:03:32 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-29 23:03:32 +0100
commitfce327a72558b41ce6a7303b38c804bfada694a1 (patch)
tree29b641622a2de287c09efd0f43655ae8926162c3 /src/frontend/tau/components/items.cljs
parent8c46de38348c421c0c9f102d604fcfc18807c0bb (diff)
feat(frontend): Modularize related streams and add responsive styles
Diffstat (limited to 'src/frontend/tau/components/items.cljs')
-rw-r--r--src/frontend/tau/components/items.cljs20
1 files changed, 20 insertions, 0 deletions
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?])]))