mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Add cover to album detail page
This commit is contained in:
parent
5cbb83a22d
commit
662eef58ad
4 changed files with 38 additions and 34 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
(ns airsonic-ui.components.artist.views
|
(ns airsonic-ui.components.artist.views
|
||||||
(:require [airsonic-ui.views.album :as album]
|
(:require [airsonic-ui.components.collection.views :as collection]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as str]))
|
||||||
|
|
||||||
(defn link-button [attrs children]
|
(defn link-button [attrs children]
|
||||||
|
|
@ -35,4 +35,4 @@
|
||||||
[lastfm-link artist-info])
|
[lastfm-link artist-info])
|
||||||
(when (:musicBrainzId artist-info)
|
(when (:musicBrainzId artist-info)
|
||||||
[musicbrainz-link artist-info])])]]]
|
[musicbrainz-link artist-info])])]]]
|
||||||
[:section.section>div.container [album/listing (:album artist)]]])
|
[:section.section>div.container [collection/listing (:album artist)]]])
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
(ns airsonic-ui.components.collection.views
|
(ns airsonic-ui.components.collection.views
|
||||||
(:require
|
"A collection is a list of audio files that belong together (e.g. an album or
|
||||||
[airsonic-ui.views.icon :refer [icon]]
|
a podcast's overview)"
|
||||||
[airsonic-ui.views.song :as song]))
|
(:require [airsonic-ui.routes :as routes :refer [url-for]]
|
||||||
|
[airsonic-ui.views.cover :refer [cover card]]
|
||||||
|
[airsonic-ui.views.icon :refer [icon]]
|
||||||
|
[airsonic-ui.views.song :as song]))
|
||||||
|
|
||||||
(defn format-duration [seconds]
|
(defn format-duration [seconds]
|
||||||
(let [hours (quot seconds 3600)
|
(let [hours (quot seconds 3600)
|
||||||
|
|
@ -18,13 +21,37 @@
|
||||||
[:li [icon :clock] (format-duration duration)]]
|
[:li [icon :clock] (format-duration duration)]]
|
||||||
year (conj [:li [icon :calendar] (str "Released in " year)]))))
|
year (conj [:li [icon :calendar] (str "Released in " year)]))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn preview [album]
|
||||||
|
(let [{:keys [artist artistId name id]} album]
|
||||||
|
[card album
|
||||||
|
:url-fn #(url-for ::routes/album-view {:id id})
|
||||||
|
:content [:div
|
||||||
|
;; link to album
|
||||||
|
[:div.title.is-5
|
||||||
|
[:a {:href (url-for ::routes/album-view {:id id})
|
||||||
|
:title name} name]]
|
||||||
|
;; link to artist page
|
||||||
|
[:div.subtitle.is-6 [:a {:href (url-for ::routes/artist-view {:id artistId})
|
||||||
|
:title artist} artist]]]]))
|
||||||
|
|
||||||
|
(defn listing [albums]
|
||||||
|
;; always show 5 in a row
|
||||||
|
[:div.columns.is-multiline.is-mobile
|
||||||
|
(for [[idx album] (map-indexed vector albums)]
|
||||||
|
^{:key idx} [:div.column.is-one-fifth-desktop.is-one-quarter-tablet.is-half-mobile
|
||||||
|
[preview album]])])
|
||||||
|
|
||||||
(defn detail
|
(defn detail
|
||||||
"Lists all songs in an album"
|
"Lists all songs in an album"
|
||||||
[{:keys [album]}]
|
[{:keys [album]}]
|
||||||
[:div
|
[:div
|
||||||
[:section.hero>div.hero-body
|
[:section.hero>div.hero-body
|
||||||
[:div.container
|
[:div.container
|
||||||
[:h2.title (:name album)]
|
[:article.media
|
||||||
[:h3.subtitle (:artist album)]
|
[:div.media-left [cover album 128]]
|
||||||
[collection-info album]]]
|
[:div.media-content
|
||||||
|
[:h2.title (:name album)]
|
||||||
|
[:h3.subtitle (:artist album)]
|
||||||
|
[collection-info album]]]]]
|
||||||
[:section.section>div.container [song/listing (:song album)]]])
|
[:section.section>div.container [song/listing (:song album)]]])
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
(ns airsonic-ui.components.library.views
|
(ns airsonic-ui.components.library.views
|
||||||
(:require [airsonic-ui.routes :as routes :refer [url-for]]
|
(:require [airsonic-ui.routes :as routes :refer [url-for]]
|
||||||
[airsonic-ui.views.album :as album]
|
[airsonic-ui.components.collection.views :as collection]
|
||||||
[airsonic-ui.helpers :refer [add-classes]]))
|
[airsonic-ui.helpers :refer [add-classes]]))
|
||||||
|
|
||||||
(defn tabs [{:keys [items active-item]}]
|
(defn tabs [{:keys [items active-item]}]
|
||||||
|
|
@ -50,11 +50,11 @@
|
||||||
[:section.hero.is-small>div.hero-body>div.container
|
[:section.hero.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 "Containing " [: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>div.container
|
[:section.section>div.container
|
||||||
[tabs {:items tab-items :active-item {:criteria criteria}}]
|
[tabs {:items tab-items :active-item {:criteria criteria}}]
|
||||||
pagination
|
pagination
|
||||||
[:section.section [album/listing (:album album-list)]]
|
[:section.section [collection/listing (:album album-list)]]
|
||||||
pagination]]))
|
pagination]]))
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
(ns airsonic-ui.views.album
|
|
||||||
(:require [airsonic-ui.routes :as routes :refer [url-for]]
|
|
||||||
[airsonic-ui.views.cover :refer [cover card]]))
|
|
||||||
|
|
||||||
(defn preview [album]
|
|
||||||
(let [{:keys [artist artistId name id]} album]
|
|
||||||
[card album
|
|
||||||
:url-fn #(url-for ::routes/album-view {:id id})
|
|
||||||
:content [:div
|
|
||||||
;; link to album
|
|
||||||
[:div.title.is-5
|
|
||||||
[:a {:href (url-for ::routes/album-view {:id id})
|
|
||||||
:title name} name]]
|
|
||||||
;; link to artist page
|
|
||||||
[:div.subtitle.is-6 [:a {:href (url-for ::routes/artist-view {:id artistId})
|
|
||||||
:title artist} artist]]]]))
|
|
||||||
|
|
||||||
(defn listing [albums]
|
|
||||||
;; always show 5 in a row
|
|
||||||
[:div.columns.is-multiline.is-mobile
|
|
||||||
(for [[idx album] (map-indexed vector albums)]
|
|
||||||
^{:key idx} [:div.column.is-one-fifth-desktop.is-one-quarter-tablet.is-half-mobile
|
|
||||||
[preview album]])])
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue