aboutsummaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/tubo/events.cljs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/frontend/tubo/events.cljs b/src/frontend/tubo/events.cljs
index a989dcc..da0657b 100644
--- a/src/frontend/tubo/events.cljs
+++ b/src/frontend/tubo/events.cljs
@@ -351,6 +351,19 @@
:store (assoc store :media-queue (:media-queue updated-db))})))
(rf/reg-event-fx
+ ::remove-from-media-queue
+ [(rf/inject-cofx :store)]
+ (fn [{:keys [db store]} [_ pos]]
+ (let [updated-db (update db :media-queue #(into (subvec % 0 pos) (subvec % (inc pos))))]
+ {:db updated-db
+ :store (assoc store :media-queue (:media-queue updated-db))
+ :fx (if (and (= pos (:media-queue-pos db)) (not (= (count (:media-queue updated-db)) 0)))
+ [[:dispatch [::change-media-queue-pos pos]]]
+ (if (= (count (:media-queue updated-db)) 0)
+ [[:dispatch [::dispose-audio-player]]
+ [:dispatch [::show-media-queue false]]]))})))
+
+(rf/reg-event-fx
::change-media-queue-pos
[(rf/inject-cofx :store)]
(fn [{:keys [db store]} [_ i]]