mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 10:43:39 +02:00
Add track numbers and album info to album view
This commit is contained in:
parent
3e842fdd5f
commit
c42b7783fe
3 changed files with 49 additions and 3 deletions
|
|
@ -1,5 +1,22 @@
|
|||
(ns airsonic-ui.components.collection.views
|
||||
(:require [airsonic-ui.views.song :as song]))
|
||||
(:require
|
||||
[airsonic-ui.views.icon :refer [icon]]
|
||||
[airsonic-ui.views.song :as song]))
|
||||
|
||||
(defn format-duration [seconds]
|
||||
(let [hours (quot seconds 3600)
|
||||
minutes (quot (rem seconds 3600) 60)
|
||||
seconds (rem seconds 60)]
|
||||
(-> (cond-> ""
|
||||
(> hours 0) (str hours "h ")
|
||||
(> minutes 0) (str minutes "m "))
|
||||
(str seconds "s"))))
|
||||
|
||||
(defn collection-info [{:keys [songCount duration year]}]
|
||||
(vec (cond-> [:ul.is-smaller.collection-info
|
||||
[:li [icon :audio-spectrum] (str songCount " tracks")]
|
||||
[:li [icon :clock] (format-duration duration)]]
|
||||
year (conj [:li [icon :calendar] (str "Released in " year)]))))
|
||||
|
||||
(defn detail
|
||||
"Lists all songs in an album"
|
||||
|
|
@ -8,5 +25,6 @@
|
|||
[:section.hero>div.hero-body
|
||||
[:div.container
|
||||
[:h2.title (:name album)]
|
||||
[:h3.subtitle (:artist album)]]]
|
||||
[:h3.subtitle (:artist album)]
|
||||
[collection-info album]]]
|
||||
[:section.section>div.container [song/listing (:song album)]]])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue