aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/tau/views/kiosk.cljs
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-29 02:26:20 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-29 02:26:20 +0100
commit8c46de38348c421c0c9f102d604fcfc18807c0bb (patch)
tree3174b4392ca3eadd24c1da06929830b220764e38 /src/frontend/tau/views/kiosk.cljs
parentdfcc61063822dfb0fe699896da312249e93d5439 (diff)
feat(frontend): Add further features and address quirks
Diffstat (limited to 'src/frontend/tau/views/kiosk.cljs')
-rw-r--r--src/frontend/tau/views/kiosk.cljs36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/frontend/tau/views/kiosk.cljs b/src/frontend/tau/views/kiosk.cljs
index 70caacf..6aea258 100644
--- a/src/frontend/tau/views/kiosk.cljs
+++ b/src/frontend/tau/views/kiosk.cljs
@@ -1,9 +1,35 @@
(ns tau.views.kiosk
(:require
- [re-frame.core :as rf]))
+ [re-frame.core :as rf]
+ [tau.components.items :as items]
+ [tau.components.loading :as loading]
+ [tau.components.navigation :as navigation]
+ [tau.events :as events]))
(defn kiosk
- [match]
- (let [{:keys [id url related-streams]} @(rf/subscribe [:kiosk])]
- [:div
- [:h1 id]]))
+ [{{:keys [serviceId kioskId]} :query-params}]
+ (let [{:keys [id url related-streams next-page]} @(rf/subscribe [:kiosk])
+ next-page-url (:url next-page)
+ service-color @(rf/subscribe [:service-color])
+ page-loading? @(rf/subscribe [:show-page-loading])
+ pagination-loading? @(rf/subscribe [:show-pagination-loading])
+ page-scroll @(rf/subscribe [:page-scroll])
+ scrolled-to-bottom? (= page-scroll (.-scrollHeight js/document.body))]
+ (when scrolled-to-bottom?
+ (rf/dispatch [::events/kiosk-pagination serviceId id next-page-url]))
+ [:div.flex.flex-col.items-center.px-5.py-2.flex-auto
+ (if page-loading?
+ [loading/page-loading-icon service-color]
+ [:div
+ [:div.flex.justify-center.items-center.my-4.mx-2
+ [:div.m-4
+ [:h1.text-2xl id]]]
+ [:div.flex.justify-center.items-center.align-center
+ [:div.flex.justify-start.flex-wrap
+ (for [[i item] (map-indexed vector related-streams)]
+ (case (:type item)
+ "stream" [items/stream-item (assoc item :key i)]
+ "channel" [items/channel-item (assoc item :key i)]
+ "playlist" [items/playlist-item (assoc item :key i)]))]]
+ (when-not (empty? next-page-url)
+ [loading/items-pagination-loading-icon service-color pagination-loading?])])]))