1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-07 10:43:39 +02:00

Move navigation to the top

Squashed commit of the following:

commit b03c1ea7ed0d2fbd56f56f3273e694abc5454101
Author: Arne Schlüter <arne@schlueter.is>
Date:   Wed Aug 29 11:38:32 2018 +0200

    Fix bug where dropdown menus behind notifications could not be hovered

commit f4d3cd3dad89d0de84f131dbef7268422b26aa35
Author: Arne Schlüter <arne@schlueter.is>
Date:   Wed Aug 29 11:16:41 2018 +0200

    Move navigation to top

commit 564d972291aebb382d1ca560a21fad332d70cd0c
Author: Arne Schlüter <arne@schlueter.is>
Date:   Wed Aug 29 10:23:17 2018 +0200

    Move audio player into its own component

commit 382e9e88021db1506efc5fb78935b7846b8257db
Author: Arne Schlüter <arne@schlueter.is>
Date:   Wed Aug 29 10:11:14 2018 +0200

    Remove link to last.fm in bio

commit f248c2999ca88eeb82769d7491b1e786ee4a7c9d
Author: Arne Schlüter <arne@schlueter.is>
Date:   Wed Aug 29 10:01:10 2018 +0200

    Add links to external services & hero headers to album and artist pages
This commit is contained in:
Arne Schlüter 2018-08-29 11:43:59 +02:00
commit 29ea86479c
17 changed files with 223 additions and 179 deletions

View file

@ -0,0 +1,38 @@
(ns airsonic-ui.components.artist.views
(:require [airsonic-ui.views.album :as album]
[clojure.string :as str]))
(defn link-button [attrs children]
[:p.control>a.button.is-small (merge attrs {:target "_blank"}) children])
(defn lastfm-bio
"Displays the last.fm biography without the 'Read more on Last.fm' link"
[artist-info]
(when (:biography artist-info)
(let [biography (str/replace (:biography artist-info) #"<a .*?>$" "")]
[:p {:dangerouslySetInnerHTML {:__html biography}}])))
(defn lastfm-link [artist-info]
[link-button {:href (:lastFmUrl artist-info)} "See on last.fm"])
(defn musicbrainz-link [artist-info]
(let [href (str "https://musicbrainz.org/artist/" (:musicBrainzId artist-info))]
[link-button {:href href} "See on musicbrainz"]))
(defn detail
"Creates a nice artist page displaying the artist's name, bio (if available and
listing) their albums."
[{:keys [artist artist-info]}]
[:div
[:section.hero>div.hero-body
[:div.container
[:h2.title (:name artist)]
[:div.content
[lastfm-bio artist-info]
(when-not (empty? (select-keys artist-info [:lastFmUrl :musicBrainzId]))
[:div.field.is-grouped
(when (:lastFmUrl artist-info)
[lastfm-link artist-info])
(when (:musicBrainzId artist-info)
[musicbrainz-link artist-info])])]]]
[:section.section>div.container [album/listing (:album artist)]]])