mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 02:33:39 +02:00
Merge incomplete podcast support
commit 4ac35d6530f7770e7b80307321c72541a55e2c8e
Author: Arne Schlüter <arne@schlueter.is>
Date: Mon Oct 8 21:09:04 2018 +0200
Stub out podcast detail view
commit 60742a22e93bfe6f432e06d56d3e4da671184559
Author: Arne Schlüter <arne@schlueter.is>
Date: Tue Sep 18 23:02:39 2018 +0200
Simplify api helpers; closes #16
commit 8bbc79ebf4dbbe3dbfa08cb4c7c1edd341d507eb
Author: Arne Schlüter <arne@schlueter.is>
Date: Tue Sep 18 19:39:17 2018 +0200
Adjust `stream-url` to work with podcast episodes
commit 991ba5b65230a7429c160ca1b7968ecbb8595e0b
Author: Arne Schlüter <arne@schlueter.is>
Date: Tue Sep 18 19:14:08 2018 +0200
Fix breadcrumbs for podcasts
commit 37c3a894eded2fe37f9af031d3132c7175702266
Author: Arne Schlüter <arne@schlueter.is>
Date: Tue Sep 18 15:11:54 2018 +0200
Stub out overview for podcasts
This commit is contained in:
parent
38eea1c8c9
commit
fa485bbf42
19 changed files with 350 additions and 133 deletions
|
|
@ -15,58 +15,81 @@
|
|||
[airsonic-ui.components.search.views :as search]
|
||||
[airsonic-ui.components.library.views :as library]
|
||||
[airsonic-ui.components.artist.views :as artist]
|
||||
[airsonic-ui.components.collection.views :as collection]))
|
||||
[airsonic-ui.components.collection.views :as collection]
|
||||
[airsonic-ui.components.podcast.views :as podcast]))
|
||||
|
||||
(def logo-url "./img/airsonic-light-350x100.png")
|
||||
|
||||
;; ---
|
||||
;; top navigation
|
||||
;; ---
|
||||
|
||||
(defonce navbar-active? (r/atom false))
|
||||
(def toggle-navbar-active! #(swap! navbar-active? not))
|
||||
|
||||
(defn navbar-item [{:keys [href]} label]
|
||||
[:a.navbar-item {:href href :on-click toggle-navbar-active!} label])
|
||||
|
||||
(defn navbar-dropdown
|
||||
([label items] (navbar-dropdown label {} items))
|
||||
([label label-opts items]
|
||||
[:div.navbar-item.has-dropdown.is-hoverable
|
||||
[:div.navbar-link label-opts label]
|
||||
[:div.navbar-dropdown
|
||||
(for [[idx [opts label]] (map-indexed vector items)]
|
||||
^{:key (str "navbar-dropdown-" idx)}
|
||||
[navbar-item
|
||||
(merge {:on-click toggle-navbar-active!} opts)
|
||||
label])]]))
|
||||
|
||||
(defn navbar-top
|
||||
"Contains search, some navigational links and the logo"
|
||||
[]
|
||||
(let [active? (r/atom false)
|
||||
toggle-active #(swap! active? not)
|
||||
navbar-item (fn navbar-item [{:keys [href]} label]
|
||||
[:a.navbar-item {:href href :on-click toggle-active} label])
|
||||
user @(subscribe [:user/info])
|
||||
(let [user @(subscribe [:user/info])
|
||||
stream-role @(subscribe [:user/roles :stream])
|
||||
podcast-role @(subscribe [:user/roles :podcast])
|
||||
playlist-role @(subscribe [:user/roles :playlist])
|
||||
share-role @(subscribe [:user/roles :share])
|
||||
settings-role @(subscribe [:user/roles :settings])]
|
||||
(fn []
|
||||
[:nav.navbar.is-fixed-top.is-dark {:role "navigation", :aria-label "search and navigation"}
|
||||
;; user is `nil` when we're not logged in, we can hide the extended navigation
|
||||
[:div.navbar-brand
|
||||
[:div.navbar-item>img {:src logo-url}]
|
||||
[:div.navbar-burger.burger {:on-click toggle-active} (repeat 3 [:span])]]
|
||||
(when user
|
||||
[(if @active? :div.navbar-menu.is-active :div.navbar-menu)
|
||||
[:div.navbar-start
|
||||
[:div.navbar-item [search/form]]]
|
||||
[:div.navbar-end
|
||||
(when stream-role
|
||||
[:div.navbar-item.has-dropdown.is-hoverable
|
||||
[:div.navbar-link "Library"]
|
||||
[:div.navbar-dropdown
|
||||
[navbar-item {:href (url-for ::routes/library {:criteria "recent"})} "Recently played"]
|
||||
[navbar-item {:href (url-for ::routes/library {:criteria "newest"})} "Newest additions"]
|
||||
[navbar-item {:href (url-for ::routes/library {:criteria "starred"})} "Starred"]]])
|
||||
(when podcast-role
|
||||
[navbar-item {} "Podcasts"])
|
||||
(when playlist-role
|
||||
[navbar-item {} "Playlists"])
|
||||
(when share-role
|
||||
[navbar-item {} "Shares"])
|
||||
[:div.navbar-item.has-dropdown.is-hoverable
|
||||
[:div.navbar-link "More"]
|
||||
[:div.navbar-dropdown.is-right
|
||||
(when settings-role
|
||||
[navbar-item "Settings"])
|
||||
[:a.navbar-item
|
||||
{:on-click (fn [_]
|
||||
(toggle-active)
|
||||
(dispatch [::events/logout]))
|
||||
:href "#"}
|
||||
(str "Logout (" (:username user) ")")]]]]])])))
|
||||
[:nav.navbar.is-fixed-top.is-dark {:role "navigation", :aria-label "search and navigation"}
|
||||
;; user is `nil` when we're not logged in, we can hide the extended navigation
|
||||
[:div.navbar-brand
|
||||
[:div.navbar-item>img {:src logo-url}]
|
||||
[:div.navbar-burger.burger {:on-click toggle-navbar-active!}
|
||||
(for [idx (range 3)] ^{:key (str "burger-" idx)} [:span])]]
|
||||
(when user
|
||||
[(if @navbar-active? :div.navbar-menu.is-active :div.navbar-menu)
|
||||
[:div.navbar-start
|
||||
[:div.navbar-item [search/form]]]
|
||||
[:div.navbar-end
|
||||
(when stream-role
|
||||
[navbar-dropdown "Library"
|
||||
[[{:href (url-for ::routes/library {:criteria "recent"})} "Recently played"]
|
||||
[{:href (url-for ::routes/library {:criteria "newest"})} "Newest additions"]
|
||||
[{:href (url-for ::routes/library {:criteria "starred"})} "Starred"]]])
|
||||
(when podcast-role
|
||||
(let [podcast-url (url-for ::routes/podcast.overview)]
|
||||
[navbar-dropdown "Podcast" {:href podcast-url}
|
||||
[[{:href podcast-url} "Overview"]]]))
|
||||
(when playlist-role
|
||||
[navbar-item {} "Playlists"])
|
||||
(when share-role
|
||||
[navbar-item {} "Shares"])
|
||||
[:div.navbar-item.has-dropdown.is-hoverable
|
||||
[:div.navbar-link "More"]
|
||||
[:div.navbar-dropdown.is-right
|
||||
(when settings-role
|
||||
[navbar-item {} "Settings"])
|
||||
[:a.navbar-item
|
||||
{:on-click (fn [_]
|
||||
(toggle-navbar-active!)
|
||||
(dispatch [::events/logout]))
|
||||
:href "#"}
|
||||
(str "Logout (" (:username user) ")")]]]]])]))
|
||||
|
||||
;; ---
|
||||
;; this is the section the user mainly interacts with
|
||||
;; ---
|
||||
|
||||
(defn media-content
|
||||
"Provides the complete UI to browse the media library, interact with search
|
||||
|
|
@ -80,12 +103,17 @@
|
|||
[breadcrumbs content]
|
||||
(case route-id
|
||||
::routes/library [library/main [route-id params query] content]
|
||||
::routes/artist-view [artist/detail content]
|
||||
::routes/album-view [collection/detail content]
|
||||
::routes/search [search/results content])]
|
||||
::routes/artist.detail [artist/detail content]
|
||||
::routes/album.detail [collection/detail content]
|
||||
::routes/search [search/results content]
|
||||
::routes/podcast.overview [podcast/overview content]
|
||||
::routes/podcast.detail [podcast/detail content])]
|
||||
[audio-player]]))
|
||||
|
||||
(defn main-panel []
|
||||
(defn main-panel
|
||||
"The outermost wrapper; handles display of the login form if necessary,
|
||||
makes the code in media-content a bit easier to follow"
|
||||
[]
|
||||
(let [notifications @(subscribe [::subs/notifications])
|
||||
is-booting? @(subscribe [::subs/is-booting?])
|
||||
[route-id params query] @(subscribe [:routes/current-route])]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue