mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 02:33:39 +02:00
parent
eaa72a9f5b
commit
7b98b8282d
6 changed files with 60 additions and 28 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
(ns airsonic-ui.components.artist.views
|
(ns airsonic-ui.components.artist.views
|
||||||
(:require [airsonic-ui.components.collection.views :as collection]
|
(:require [airsonic-ui.components.collection.views :as collection]
|
||||||
|
[airsonic-ui.components.library.views :as library]
|
||||||
[airsonic-ui.routes :as routes]
|
[airsonic-ui.routes :as routes]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as str]))
|
||||||
|
|
||||||
|
|
@ -68,7 +69,7 @@
|
||||||
(defn overview
|
(defn overview
|
||||||
"Displays the alphabetical listing of all artists along with some additional
|
"Displays the alphabetical listing of all artists along with some additional
|
||||||
information about the collection"
|
information about the collection"
|
||||||
[{:keys [artists]}]
|
[current-route {:keys [artists]}]
|
||||||
(let [artists (:index artists)
|
(let [artists (:index artists)
|
||||||
;; TODO: Calculations in views should be avoided
|
;; TODO: Calculations in views should be avoided
|
||||||
artists-count (count (mapcat :artist artists))
|
artists-count (count (mapcat :artist artists))
|
||||||
|
|
@ -76,8 +77,9 @@
|
||||||
(map :albumCount)
|
(map :albumCount)
|
||||||
(reduce +))]
|
(reduce +))]
|
||||||
[:div
|
[:div
|
||||||
[:section.hero.is-small>div.hero-body
|
[library/tab-section current-route]
|
||||||
|
[:section.hero.single-line.is-small>div.hero-body
|
||||||
[:div.container
|
[:div.container
|
||||||
[:h1.title "Artists"]
|
[:h1.title "Artists"]
|
||||||
[:p.subtitle.is-5.has-text-grey [:strong artists-count] " artists in your collection with " [:strong album-count] " albums"]]]
|
[:p.subtitle.is-5.has-text-grey [:strong artists-count] " artists with " [:strong album-count] " albums"]]]
|
||||||
[:section.section>div.container [alphabetical-listing artists]]]))
|
[:section.section>div.container [alphabetical-listing artists]]]))
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,8 @@
|
||||||
(->>
|
(->>
|
||||||
[[[::routes/library {:kind "recent"}] "Recently played"]
|
[[[::routes/library {:kind "recent"}] "Recently played"]
|
||||||
[[::routes/library {:kind "newest"}] "Newest additions"]
|
[[::routes/library {:kind "newest"}] "Newest additions"]
|
||||||
[[::routes/library {:kind "starred"}] "Starred"]]
|
[[::routes/library {:kind "starred"}] "Starred"]
|
||||||
|
[[::routes/artist.overview] "Artists"]]
|
||||||
(map (fn [[[id params :as route] label]]
|
(map (fn [[[id params :as route] label]]
|
||||||
(cond-> {:href (apply routes/url-for route)
|
(cond-> {:href (apply routes/url-for route)
|
||||||
:label label}
|
:label label}
|
||||||
|
|
@ -63,12 +64,17 @@
|
||||||
(= (:kind params) (:kind current-params)))
|
(= (:kind params) (:kind current-params)))
|
||||||
(assoc :active? true))))))
|
(assoc :active? true))))))
|
||||||
|
|
||||||
|
(defn tab-section [current-route]
|
||||||
|
[:section.section.ui-tab-bar.is-small>div.container
|
||||||
|
[tabs {:items (tab-items current-route)}]])
|
||||||
|
|
||||||
(defn main
|
(defn main
|
||||||
"Renders the pagination and shows a list of all albums with their cover art.
|
"Renders the pagination and shows a list of all albums with their cover art.
|
||||||
The first parameter is the route that's passed in, the second one is the
|
The first parameter is the route that's passed in, the second one is the
|
||||||
content that has been fetched for that route."
|
content that has been fetched for that route."
|
||||||
[[_ {:keys [kind]} {:keys [page] :or {page 1}} :as current-route]
|
[[_ {:keys [kind]} {:keys [page] :or {page 1}} :as current-route]
|
||||||
{:keys [scan-status]}]
|
{:keys [scan-status]}]
|
||||||
|
(println "scan-status" scan-status)
|
||||||
(let [library @(subscribe [:library/paginated kind])
|
(let [library @(subscribe [:library/paginated kind])
|
||||||
page (int page)
|
page (int page)
|
||||||
current-items (get library page)
|
current-items (get library page)
|
||||||
|
|
@ -77,14 +83,13 @@
|
||||||
:items library
|
:items library
|
||||||
:url-fn url-fn}]]
|
:url-fn url-fn}]]
|
||||||
[:div
|
[:div
|
||||||
[:section.hero.is-small>div.hero-body>div.container
|
[tab-section current-route]
|
||||||
|
[:section.hero.single-line.is-small>div.hero-body>div.container
|
||||||
[:h2.title "Your library"]
|
[:h2.title "Your library"]
|
||||||
(if (:count scan-status)
|
(if (:count scan-status)
|
||||||
[:p.subtitle.is-5.has-text-grey [:strong (:count scan-status)] " items"]
|
[:p.subtitle.is-5.has-text-grey [:strong (:count scan-status)] " items"]
|
||||||
(when (:scanning scan-status)
|
(when (:scanning scan-status)
|
||||||
[:p.subtitle.is-5.has-text-grey "Scanning…"]))]
|
[:p.subtitle.is-5.has-text-grey "Scanning…"]))]
|
||||||
[:section.section.is-small>div.container
|
|
||||||
[tabs {:items (tab-items current-route)}]]
|
|
||||||
[:section.section.is-tiny>div.container pagination-links]
|
[:section.section.is-tiny>div.container pagination-links]
|
||||||
[:section.section.is-tiny>div.container [collection/listing current-items]]
|
[:section.section.is-tiny>div.container [collection/listing current-items]]
|
||||||
[:section.section.is-tiny>div.container pagination-links]]))
|
[:section.section.is-tiny>div.container pagination-links]]))
|
||||||
|
|
|
||||||
|
|
@ -60,17 +60,19 @@
|
||||||
[:nav.navbar.is-fixed-top.is-dark {:role "navigation", :aria-label "search and navigation"}
|
[: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
|
;; user is `nil` when we're not logged in, we can hide the extended navigation
|
||||||
[:div.navbar-brand
|
[:div.navbar-brand
|
||||||
[:div.navbar-item
|
[:div.navbar-item
|
||||||
[:a {:href (url-for ::routes/library)} [:img {:src logo-url}]]
|
[:a {:href (url-for ::routes/library)} [:img {:src logo-url}]]
|
||||||
[:div.navbar-burger.burger {:on-click toggle-navbar-active!}
|
[:div.navbar-burger.burger {:on-click toggle-navbar-active!}
|
||||||
(for [idx (range 3)] ^{:key (str "burger-" idx)} [:span])]]]
|
[:span]
|
||||||
|
[:span]
|
||||||
|
[:span]]]]
|
||||||
(when user
|
(when user
|
||||||
[(if @navbar-active? :div.navbar-menu.is-active :div.navbar-menu)
|
[(if @navbar-active? :div.navbar-menu.is-active :div.navbar-menu)
|
||||||
[:div.navbar-start
|
[:div.navbar-start
|
||||||
[:div.navbar-item [search/form]]]
|
[:div.navbar-item [search/form]]]
|
||||||
[:div.navbar-end
|
[:div.navbar-end
|
||||||
[:a.navbar-item {:href (url-for ::routes/current-queue)
|
[:a.navbar-item {:href (url-for ::routes/current-queue)
|
||||||
:title "Current queue"} [icon :audio-spectrum]]
|
:title "Current queue"} [:span.heart-beat [icon :audio-spectrum]]]
|
||||||
(when stream-role
|
(when stream-role
|
||||||
[navbar-dropdown "Library"
|
[navbar-dropdown "Library"
|
||||||
[[{:href (url-for ::routes/library {:kind "recent"})} "Recently played"]
|
[[{:href (url-for ::routes/library {:kind "recent"})} "Recently played"]
|
||||||
|
|
@ -112,7 +114,7 @@
|
||||||
[breadcrumbs route content]
|
[breadcrumbs route content]
|
||||||
(case route-id
|
(case route-id
|
||||||
::routes/library [library/main route content]
|
::routes/library [library/main route content]
|
||||||
::routes/artist.overview [artist/overview content]
|
::routes/artist.overview [artist/overview route content]
|
||||||
::routes/artist.detail [artist/detail content]
|
::routes/artist.detail [artist/detail content]
|
||||||
::routes/album.detail [collection/detail content]
|
::routes/album.detail [collection/detail content]
|
||||||
::routes/search [search/results content]
|
::routes/search [search/results content]
|
||||||
|
|
|
||||||
|
|
@ -17,36 +17,48 @@
|
||||||
(when content-pending? [:span.loader])]]]]))
|
(when content-pending? [:span.loader])]]]]))
|
||||||
|
|
||||||
(defmulti breadcrumbs
|
(defmulti breadcrumbs
|
||||||
(fn dispatch-on [[route-id] content] route-id))
|
;; the first parameter is always the current route, the second parameter is
|
||||||
|
;; whatever the subscriptions return as the current content (e.g. album title)
|
||||||
|
(fn dispatch-on [[route-id] _] route-id))
|
||||||
|
|
||||||
(defmethod breadcrumbs :default [_ _]
|
(defmethod breadcrumbs :default [_ _]
|
||||||
[bulma-breadcrumbs "Start"])
|
[bulma-breadcrumbs "Airsonic"])
|
||||||
|
|
||||||
(def start [(url-for ::routes/library) "Start"])
|
(defmethod breadcrumbs ::routes/library [[_ params] _]
|
||||||
|
[bulma-breadcrumbs
|
||||||
|
[(url-for ::routes/library {:kind "recent"}) "Library"]
|
||||||
|
(case (:kind params)
|
||||||
|
"recent" "Recently played"
|
||||||
|
"newest" "Newest additions"
|
||||||
|
"starred" "Starred")])
|
||||||
|
|
||||||
(defmethod breadcrumbs ::routes/artist.overview [_ _]
|
(defmethod breadcrumbs ::routes/artist.overview [_ _]
|
||||||
[bulma-breadcrumbs start "Artists"])
|
[bulma-breadcrumbs
|
||||||
|
[(url-for ::routes/library {:kind "recent"}) "Library"]
|
||||||
|
"Artists"])
|
||||||
|
|
||||||
(defmethod breadcrumbs ::routes/artist.detail [_ {:keys [artist]}]
|
(defmethod breadcrumbs ::routes/artist.detail [_ {:keys [artist]}]
|
||||||
[bulma-breadcrumbs start
|
[bulma-breadcrumbs
|
||||||
|
[(url-for ::routes/library {:kind "recent"}) "Library"]
|
||||||
[(url-for ::routes/artist.overview) "Artists"]
|
[(url-for ::routes/artist.overview) "Artists"]
|
||||||
(:name artist)])
|
(:name artist)])
|
||||||
|
|
||||||
(defmethod breadcrumbs ::routes/album.detail [_ {:keys [album]}]
|
(defmethod breadcrumbs ::routes/album.detail [_ {:keys [album]}]
|
||||||
[bulma-breadcrumbs start
|
[bulma-breadcrumbs
|
||||||
|
[(url-for ::routes/library {:kind "recent"}) "Library"]
|
||||||
[(url-for ::routes/artist.overview) "Artists"]
|
[(url-for ::routes/artist.overview) "Artists"]
|
||||||
[(url-for ::routes/artist.detail {:id (:artistId album)}) (:artist album)]
|
[(url-for ::routes/artist.detail {:id (:artistId album)}) (:artist album)]
|
||||||
(:name album)])
|
(:name album)])
|
||||||
|
|
||||||
(defmethod breadcrumbs ::routes/search [_ _]
|
(defmethod breadcrumbs ::routes/search [_ _]
|
||||||
[bulma-breadcrumbs start "Search"])
|
[bulma-breadcrumbs "Search"])
|
||||||
|
|
||||||
(defmethod breadcrumbs ::routes/podcast.overview [_ _]
|
(defmethod breadcrumbs ::routes/podcast.overview [_ _]
|
||||||
;; TODO: Detail view
|
;; TODO: Detail view
|
||||||
[bulma-breadcrumbs start "Podcasts"])
|
[bulma-breadcrumbs "Podcasts"])
|
||||||
|
|
||||||
(defmethod breadcrumbs ::routes/current-queue [_ _]
|
(defmethod breadcrumbs ::routes/current-queue [_ _]
|
||||||
[bulma-breadcrumbs start "Current Queue"])
|
[bulma-breadcrumbs "Current Queue"])
|
||||||
|
|
||||||
(defmethod breadcrumbs ::routes/about [_ _]
|
(defmethod breadcrumbs ::routes/about [_ _]
|
||||||
[bulma-breadcrumbs start "About"])
|
[bulma-breadcrumbs "About"])
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
(ns bulma.tabs)
|
(ns bulma.tabs)
|
||||||
|
|
||||||
(defn tabs [{:keys [items]}]
|
(defn tabs [{:keys [items]}]
|
||||||
[:div.tabs
|
[:div.tabs.is-boxed
|
||||||
[:ul
|
[:ul
|
||||||
(for [[idx {:keys [href label active?]}] (map-indexed vector items)]
|
(for [[idx {:keys [href label active?]}] (map-indexed vector items)]
|
||||||
^{:key idx} [:li (when active? {:class "is-active"})
|
^{:key idx} [:li (when active? {:class "is-active"})
|
||||||
|
|
|
||||||
|
|
@ -228,19 +228,30 @@
|
||||||
&.is-tiny
|
&.is-tiny
|
||||||
padding: 0.75rem 1.5rem
|
padding: 0.75rem 1.5rem
|
||||||
|
|
||||||
// tab bar on top
|
// tab bar on top
|
||||||
.ui-tab-bar
|
&.ui-tab-bar
|
||||||
padding-top: 100px
|
padding-bottom: 0.75rem
|
||||||
padding-bottom: 0.75rem
|
|
||||||
|
|
||||||
// occurs on many pages at the top to show details
|
// occurs on many pages at the top to show details
|
||||||
.hero
|
.hero
|
||||||
&.is-small + .section
|
&.is-small + .section
|
||||||
padding-top: 0
|
padding: 1.5rem 1.5rem
|
||||||
|
|
||||||
|
&.is-tiny + .section
|
||||||
|
padding: 0.75rem 1.5rem
|
||||||
|
|
||||||
.media-content
|
.media-content
|
||||||
align-self: center
|
align-self: center
|
||||||
|
|
||||||
|
// modifies our headlines to be next to each other
|
||||||
|
+tablet
|
||||||
|
&.single-line .container
|
||||||
|
display: flex
|
||||||
|
align-items: baseline
|
||||||
|
.title
|
||||||
|
flex-grow: 1
|
||||||
|
margin-bottom: 0
|
||||||
|
|
||||||
// floating notifications
|
// floating notifications
|
||||||
.notifications:not(:empty)
|
.notifications:not(:empty)
|
||||||
@extend .container
|
@extend .container
|
||||||
|
|
@ -363,4 +374,4 @@ tr.sortable-is-moving.is-playing
|
||||||
// Navigation fixes
|
// Navigation fixes
|
||||||
.navbar-brand > .navbar-item > a
|
.navbar-brand > .navbar-item > a
|
||||||
display: flex
|
display: flex
|
||||||
align-items: center
|
align-items: center
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue