aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/frontend/tubo/kiosks/views.cljs9
-rw-r--r--src/frontend/tubo/playlist/views.cljs8
-rw-r--r--src/frontend/tubo/search/views.cljs9
-rw-r--r--src/frontend/tubo/subs.cljs25
4 files changed, 11 insertions, 40 deletions
diff --git a/src/frontend/tubo/kiosks/views.cljs b/src/frontend/tubo/kiosks/views.cljs
index 842f591..49497c3 100644
--- a/src/frontend/tubo/kiosks/views.cljs
+++ b/src/frontend/tubo/kiosks/views.cljs
@@ -39,10 +39,9 @@
(let [{:keys [id related-streams next-page]}
@(rf/subscribe [:kiosk])
next-page-url (:url next-page)
- service-id (or @(rf/subscribe [:service-id]) serviceId)
- scrolled-to-bottom? @(rf/subscribe [:scrolled-to-bottom])]
- (when scrolled-to-bottom?
- (rf/dispatch [:kiosks/fetch-paginated service-id id next-page-url]))
+ service-id (or @(rf/subscribe [:service-id]) serviceId)]
[layout/content-container
[layout/content-header id [items/layout-switcher !layout]]
- [items/related-streams related-streams next-page-url !layout]]))))
+ [items/related-streams related-streams next-page-url !layout
+ #(rf/dispatch [:kiosks/fetch-paginated service-id id
+ next-page-url])]]))))
diff --git a/src/frontend/tubo/playlist/views.cljs b/src/frontend/tubo/playlist/views.cljs
index 09fe2a0..8a4f1fd 100644
--- a/src/frontend/tubo/playlist/views.cljs
+++ b/src/frontend/tubo/playlist/views.cljs
@@ -31,10 +31,7 @@
stream-count]
:as playlist}
@(rf/subscribe [:playlist])
- next-page-url (:url next-page)
- scrolled-to-bottom? @(rf/subscribe [:scrolled-to-bottom])]
- (when scrolled-to-bottom?
- (rf/dispatch [:playlist/fetch-paginated url next-page-url]))
+ next-page-url (:url next-page)]
[layout/content-container
[:div.flex.flex-col.justify-center
[layout/content-header
@@ -51,4 +48,5 @@
:title uploader-name}
uploader-name]]
[items/layout-switcher !layout]]]
- [items/related-streams related-streams next-page-url !layout]]))))
+ [items/related-streams related-streams next-page-url !layout
+ #(rf/dispatch [:playlist/fetch-paginated url next-page-url])]]))))
diff --git a/src/frontend/tubo/search/views.cljs b/src/frontend/tubo/search/views.cljs
index 4cfe90e..6abe362 100644
--- a/src/frontend/tubo/search/views.cljs
+++ b/src/frontend/tubo/search/views.cljs
@@ -12,10 +12,9 @@
(let [{:keys [items next-page]} @(rf/subscribe [:search/results])
next-page-url (:url next-page)
service-id (or @(rf/subscribe [:service-id])
- serviceId)
- scrolled-to-bottom? @(rf/subscribe [:scrolled-to-bottom])]
- (when scrolled-to-bottom?
- (rf/dispatch [:search/fetch-paginated q service-id next-page-url]))
+ serviceId)]
[layout/content-container
[items/layout-switcher !layout]
- [items/related-streams items next-page-url !layout]]))))
+ [items/related-streams items next-page-url !layout
+ #(rf/dispatch [:search/fetch-paginated q service-id
+ next-page-url])]]))))
diff --git a/src/frontend/tubo/subs.cljs b/src/frontend/tubo/subs.cljs
index 9b952e1..8c0575f 100644
--- a/src/frontend/tubo/subs.cljs
+++ b/src/frontend/tubo/subs.cljs
@@ -18,21 +18,6 @@
[tubo.settings.subs]
[tubo.stream.subs]))
-(defonce !is-window-visible
- (let [a (r/atom true)]
- (.addEventListener js/window "focus" #(reset! a true))
- (.addEventListener js/window "blur" #(reset! a false))
- a))
-
-(defonce !scroll-distance
- (let [a (r/atom 0)
- compute-scroll-distance
- #(when (> (.-scrollY js/window) 0)
- (reset! a (+ (.-scrollY js/window) (.-innerHeight js/window))))]
- (.addEventListener js/window "scroll" compute-scroll-distance)
- (.addEventListener js/window "touchmove" compute-scroll-distance)
- a))
-
(defonce !auto-theme
(let [theme (r/atom (when (and (.-matchMedia js/window)
(.-matches
@@ -45,16 +30,6 @@
theme))
(rf/reg-sub
- :is-window-visible
- (fn [_ _]
- @!is-window-visible))
-
-(rf/reg-sub
- :scrolled-to-bottom
- (fn [_ _]
- (> (+ @!scroll-distance 35) (.-scrollHeight js/document.body))))
-
-(rf/reg-sub
:dark-theme
(fn [_]
(rf/subscribe [:settings]))