aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/frontend/tubo/bookmarks/views.cljs2
-rw-r--r--src/frontend/tubo/channel/views.cljs2
-rw-r--r--src/frontend/tubo/player/events.cljs6
-rw-r--r--src/frontend/tubo/playlist/views.cljs2
-rw-r--r--src/frontend/tubo/queue/events.cljs22
-rw-r--r--src/frontend/tubo/stream/views.cljs2
6 files changed, 25 insertions, 11 deletions
diff --git a/src/frontend/tubo/bookmarks/views.cljs b/src/frontend/tubo/bookmarks/views.cljs
index 51f2ef5..c25a0b4 100644
--- a/src/frontend/tubo/bookmarks/views.cljs
+++ b/src/frontend/tubo/bookmarks/views.cljs
@@ -59,7 +59,7 @@
[layout/popover-menu !menu-active?
[{:label "Add to queue"
:icon [:i.fa-solid.fa-headphones]
- :on-click #(rf/dispatch [:queue/add-n items])}
+ :on-click #(rf/dispatch [:queue/add-n items true])}
{:label "Add to playlist"
:icon [:i.fa-solid.fa-plus]
:on-click #(rf/dispatch [:modals/open [modals/add-to-bookmark items]])}]])]
diff --git a/src/frontend/tubo/channel/views.cljs b/src/frontend/tubo/channel/views.cljs
index b799ef1..d99923d 100644
--- a/src/frontend/tubo/channel/views.cljs
+++ b/src/frontend/tubo/channel/views.cljs
@@ -38,7 +38,7 @@
[layout/popover-menu !menu-active?
[{:label "Add to queue"
:icon [:i.fa-solid.fa-headphones]
- :on-click #(rf/dispatch [:queue/add-n related-streams])}
+ :on-click #(rf/dispatch [:queue/add-n related-streams true])}
{:label "Add to playlist"
:icon [:i.fa-solid.fa-plus]
:on-click #(rf/dispatch [:modals/open [modals/add-to-bookmark related-streams]])}]])]
diff --git a/src/frontend/tubo/player/events.cljs b/src/frontend/tubo/player/events.cljs
index 786cb3c..c7d1a1c 100644
--- a/src/frontend/tubo/player/events.cljs
+++ b/src/frontend/tubo/player/events.cljs
@@ -182,7 +182,11 @@
(assoc :show-background-player true)
(assoc :queue (:queue updated-db)))
:fx [[:dispatch [:player/fetch-stream
- (:url stream) idx (= (count (:queue db)) 0)]]]})))
+ (:url stream) idx (= (count (:queue db)) 0)]]
+ (when-not (= (count (:queue db)) 0)
+ [:dispatch [:notifications/add
+ {:status-text (str "Added stream to queue")
+ :failure :success}]])]})))
(rf/reg-event-fx
:player/load-related-streams
diff --git a/src/frontend/tubo/playlist/views.cljs b/src/frontend/tubo/playlist/views.cljs
index 737fab4..39adb88 100644
--- a/src/frontend/tubo/playlist/views.cljs
+++ b/src/frontend/tubo/playlist/views.cljs
@@ -25,7 +25,7 @@
[layout/popover-menu !menu-active?
[{:label "Add to queue"
:icon [:i.fa-solid.fa-headphones]
- :on-click #(rf/dispatch [:queue/add-n related-streams])}
+ :on-click #(rf/dispatch [:queue/add-n related-streams true])}
{:label "Add to playlist"
:icon [:i.fa-solid.fa-plus]
:on-click #(rf/dispatch [:modals/open [modals/add-to-bookmark related-streams]])}]])]
diff --git a/src/frontend/tubo/queue/events.cljs b/src/frontend/tubo/queue/events.cljs
index 296dc37..e60c661 100644
--- a/src/frontend/tubo/queue/events.cljs
+++ b/src/frontend/tubo/queue/events.cljs
@@ -11,20 +11,30 @@
(rf/reg-event-fx
:queue/add
[(rf/inject-cofx :store)]
- (fn [{:keys [db store]} [_ stream]]
+ (fn [{:keys [db store]} [_ stream notify?]]
(let [updated-db (update db :queue conj stream)]
{:db updated-db
- :store (assoc store :queue (:queue updated-db))})))
+ :store (assoc store :queue (:queue updated-db))
+ :fx (if notify?
+ [[:dispatch [:notifications/add
+ {:status-text "Added stream to queue"
+ :failure :success}]]]
+ [])})))
(rf/reg-event-fx
:queue/add-n
[(rf/inject-cofx :store)]
- (fn [{:keys [db store]} [_ streams]]
+ (fn [{:keys [db store]} [_ streams notify?]]
{:db (assoc db :show-background-player true)
:store (assoc store :show-background-player true)
- :fx (conj (map (fn [stream] [:dispatch [:queue/add stream]]) streams)
- [:dispatch [:player/fetch-stream (-> streams first :url)
- (count (:queue db)) (= (count (:queue db)) 0)]])}))
+ :fx (into (map (fn [stream] [:dispatch [:queue/add stream]]) streams)
+ [[:dispatch [:player/fetch-stream (-> streams first :url)
+ (count (:queue db)) (= (count (:queue db)) 0)]]
+ (when notify?
+ [:dispatch [:notifications/add
+ {:status-text (str "Added " (count streams)
+ " streams to queue")
+ :failure :success}]])])}))
(rf/reg-event-fx
:queue/remove
diff --git a/src/frontend/tubo/stream/views.cljs b/src/frontend/tubo/stream/views.cljs
index 2b623a5..31e001f 100644
--- a/src/frontend/tubo/stream/views.cljs
+++ b/src/frontend/tubo/stream/views.cljs
@@ -156,7 +156,7 @@
:right-button [layout/popover-menu !menu-active?
[{:label "Add to queue"
:icon [:i.fa-solid.fa-headphones]
- :on-click #(rf/dispatch [:queue/add-n related-streams])}
+ :on-click #(rf/dispatch [:queue/add-n related-streams true])}
{:label "Add to playlist"
:icon [:i.fa-solid.fa-plus]
:on-click #(rf/dispatch [:modals/open [modals/add-to-bookmark related-streams]])}]]}