diff options
-rw-r--r-- | src/frontend/tubo/components/audio_player.cljs | 11 | ||||
-rw-r--r-- | src/frontend/tubo/components/items.cljs | 2 | ||||
-rw-r--r-- | src/frontend/tubo/components/modals/bookmarks.cljs | 4 | ||||
-rw-r--r-- | src/frontend/tubo/events.cljs | 10 | ||||
-rw-r--r-- | src/frontend/tubo/views/bookmarks.cljs | 6 | ||||
-rw-r--r-- | src/frontend/tubo/views/channel.cljs | 7 | ||||
-rw-r--r-- | src/frontend/tubo/views/playlist.cljs | 7 | ||||
-rw-r--r-- | src/frontend/tubo/views/stream.cljs | 6 |
8 files changed, 44 insertions, 9 deletions
diff --git a/src/frontend/tubo/components/audio_player.cljs b/src/frontend/tubo/components/audio_player.cljs index 1b379ea..279f9c1 100644 --- a/src/frontend/tubo/components/audio_player.cljs +++ b/src/frontend/tubo/components/audio_player.cljs @@ -89,6 +89,7 @@ [uploader-name uploader-url thumbnail-url name stream url service-id] :as current-stream} @(rf/subscribe [:media-queue-stream]) + media-queue @(rf/subscribe [:media-queue]) show-audio-player? @(rf/subscribe [:show-audio-player]) show-media-queue? @(rf/subscribe [:show-media-queue]) volume-level @(rf/subscribe [:volume-level]) @@ -115,11 +116,11 @@ [:img.min-h-full.max-h-full.object-cover.min-w-full.max-w-full.w-full {:src thumbnail-url}]] [:div.flex.flex-col.px-2 [:a.text-xs.line-clamp-1 - {:href (rfe/href :tubo.routes/stream nil {:url url}) + {:href (rfe/href :tubo.routes/stream nil {:url url}) :title name} name] [:a.text-xs.pt-2.text-neutral-600.dark:text-neutral-300.line-clamp-1 - {:href (rfe/href :tubo.routes/channel nil {:url uploader-url}) + {:href (rfe/href :tubo.routes/channel nil {:url uploader-url}) :title uploader-name} uploader-name]] [audio-source !player]] @@ -136,10 +137,14 @@ {:label "Play radio" :icon [:i.fa-solid.fa-tower-cell] :on-click #(rf/dispatch [::events/start-stream-radio current-stream])} - {:label "Add to playlist" + {:label "Add current to playlist" :icon [:i.fa-solid.fa-plus] :on-click #(rf/dispatch [::events/add-bookmark-list-modal [bookmarks/add-to-bookmark-list-modal current-stream]])} + {:label "Add queue to playlist" + :icon [:i.fa-solid.fa-list] + :on-click #(rf/dispatch [::events/add-bookmark-list-modal + [bookmarks/add-to-bookmark-list-modal media-queue]])} {:label "Remove from queue" :icon [:i.fa-solid.fa-trash] :on-click #(rf/dispatch [::events/remove-from-media-queue media-queue-pos])} diff --git a/src/frontend/tubo/components/items.cljs b/src/frontend/tubo/components/items.cljs index 6777ad7..82641b9 100644 --- a/src/frontend/tubo/components/items.cljs +++ b/src/frontend/tubo/components/items.cljs @@ -39,7 +39,7 @@ [(when (and bookmarks (some #(= (:id %) bookmark-id) (rest bookmarks))) {:label "Remove playlist" :icon [:i.fa-solid.fa-trash] - :on-click #(rf/dispatch [::events/remove-bookmark-list bookmark-id])})])] + :on-click #(rf/dispatch [::events/remove-bookmark-list bookmark-id true])})])] [:<> (when name [:div.flex.items-center.my-2 diff --git a/src/frontend/tubo/components/modals/bookmarks.cljs b/src/frontend/tubo/components/modals/bookmarks.cljs index 9c212eb..befcfe8 100644 --- a/src/frontend/tubo/components/modals/bookmarks.cljs +++ b/src/frontend/tubo/components/modals/bookmarks.cljs @@ -9,7 +9,9 @@ (defn bookmark-list-item [{:keys [items id name] :as bookmark} item] [:div.flex.w-full.h-24.rounded.cursor-pointer.hover:bg-gray-100.dark:hover:bg-stone-800.px-2 - {:on-click #(rf/dispatch [:tubo.events/add-to-bookmark-list bookmark item])} + {:on-click #(rf/dispatch (if (vector? item) + [:tubo.events/add-related-streams-to-bookmark-list bookmark item] + [:tubo.events/add-to-bookmark-list bookmark item true]))} [:div.w-24 [layout/thumbnail (-> items first :thumbnail-url) nil name nil :classes "h-24"]] diff --git a/src/frontend/tubo/events.cljs b/src/frontend/tubo/events.cljs index 4980ab5..f01bdf5 100644 --- a/src/frontend/tubo/events.cljs +++ b/src/frontend/tubo/events.cljs @@ -661,6 +661,16 @@ [])}))) (rf/reg-event-fx + ::add-related-streams-to-bookmark-list + (fn [_ [_ bookmark related-streams]] + {:fx (conj (map (fn [s] [:dispatch [::add-to-bookmark-list bookmark s]]) related-streams) + [:dispatch [::add-notification + {:status-text (str "Added " (count related-streams) + " items to playlist \"" + (:name bookmark) "\"") + :failure :success}]])})) + +(rf/reg-event-fx ::add-to-bookmark-list [(rf/inject-cofx :store)] (fn [{:keys [db store]} [_ bookmark item notify?]] diff --git a/src/frontend/tubo/views/bookmarks.cljs b/src/frontend/tubo/views/bookmarks.cljs index 2e14a3a..cf827bb 100644 --- a/src/frontend/tubo/views/bookmarks.cljs +++ b/src/frontend/tubo/views/bookmarks.cljs @@ -71,5 +71,9 @@ [layout/popover-menu !menu-active? [{:label "Add to queue" :icon [:i.fa-solid.fa-headphones] - :on-click #(rf/dispatch [::events/enqueue-related-streams items])}]])] + :on-click #(rf/dispatch [::events/enqueue-related-streams items])} + {:label "Add to playlist" + :icon [:i.fa-solid.fa-plus] + :on-click #(rf/dispatch [::events/add-bookmark-list-modal + [bookmarks/add-to-bookmark-list-modal items]])}]])] [items/related-streams (map #(assoc % :type "stream" :bookmark-id id) items)]])))) diff --git a/src/frontend/tubo/views/channel.cljs b/src/frontend/tubo/views/channel.cljs index 6fc61fc..3b99b52 100644 --- a/src/frontend/tubo/views/channel.cljs +++ b/src/frontend/tubo/views/channel.cljs @@ -4,6 +4,7 @@ [re-frame.core :as rf] [tubo.components.items :as items] [tubo.components.layout :as layout] + [tubo.components.modals.bookmarks :as bookmarks] [tubo.events :as events])) (defn channel @@ -36,7 +37,11 @@ [layout/popover-menu !menu-active? [{:label "Add to queue" :icon [:i.fa-solid.fa-headphones] - :on-click #(rf/dispatch [::events/enqueue-related-streams related-streams])}]])] + :on-click #(rf/dispatch [::events/enqueue-related-streams related-streams])} + {:label "Add to playlist" + :icon [:i.fa-solid.fa-plus] + :on-click #(rf/dispatch [::events/add-bookmark-list-modal + [bookmarks/add-to-bookmark-list-modal related-streams]])}]])] [layout/show-more-container @!show-description? description #(reset! !show-description? (not @!show-description?))] [items/related-streams related-streams next-page-url]])))))) diff --git a/src/frontend/tubo/views/playlist.cljs b/src/frontend/tubo/views/playlist.cljs index 6782c0b..b11e1e6 100644 --- a/src/frontend/tubo/views/playlist.cljs +++ b/src/frontend/tubo/views/playlist.cljs @@ -5,6 +5,7 @@ [reitit.frontend.easy :as rfe]
[tubo.components.items :as items]
[tubo.components.layout :as layout]
+ [tubo.components.modals.bookmarks :as bookmarks]
[tubo.events :as events]))
(defn playlist
@@ -26,7 +27,11 @@ [layout/popover-menu !menu-active?
[{:label "Add to queue"
:icon [:i.fa-solid.fa-headphones]
- :on-click #(rf/dispatch [::events/enqueue-related-streams related-streams])}]])]
+ :on-click #(rf/dispatch [::events/enqueue-related-streams related-streams])}
+ {:label "Add to playlist"
+ :icon [:i.fa-solid.fa-plus]
+ :on-click #(rf/dispatch [::events/add-bookmark-list-modal
+ [bookmarks/add-to-bookmark-list-modal related-streams]])}]])]
[:div.flex.items-center.justify-between.my-4.gap-x-4
[:div.flex.items-center
[layout/uploader-avatar uploader-avatar uploader-name uploader-url]
diff --git a/src/frontend/tubo/views/stream.cljs b/src/frontend/tubo/views/stream.cljs index 097ff90..0014a85 100644 --- a/src/frontend/tubo/views/stream.cljs +++ b/src/frontend/tubo/views/stream.cljs @@ -138,5 +138,9 @@ :right-button [layout/popover-menu !suggested-menu-active? [{:label "Add to queue" :icon [:i.fa-solid.fa-headphones] - :on-click #(rf/dispatch [::events/enqueue-related-streams related-streams])}]]} + :on-click #(rf/dispatch [::events/enqueue-related-streams related-streams])} + {:label "Add to playlist" + :icon [:i.fa-solid.fa-plus] + :on-click #(rf/dispatch [::events/add-bookmark-list-modal + [bookmarks/add-to-bookmark-list-modal related-streams]])}]]} [items/related-streams related-streams nil]])]]])))) |