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

Show current queue (closes #23)

commit 77d9068b8ced163d89d280f0e4ea40f3a55a831d
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon Oct 8 23:49:49 2018 +0200

    Mark current track everywhere in app

commit 6243f87b3bdf64b27afeae5007386d4a7fe32fea
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon Oct 8 23:33:07 2018 +0200

    s/currently playing/current queue/, move link to own button and add about page

commit 1dfb00b0623f64ae32953f112192894008c6adc9
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon Oct 8 22:32:11 2018 +0200

    Implement simple "currently playing" page

commit a2fef45a8a8989e1d176d859c875d994982f7329
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon Oct 8 22:00:37 2018 +0200

    Hide unimplemented / incomplete features from navbar and add 404 page
This commit is contained in:
Arne Schlüter 2018-10-08 23:50:34 +02:00
commit b5763ca4a5
9 changed files with 112 additions and 41 deletions

View file

@ -1,5 +1,6 @@
(ns airsonic-ui.components.audio-player.views
(:require [re-frame.core :refer [subscribe]]
[airsonic-ui.routes :as routes]
[airsonic-ui.helpers :refer [add-classes muted-dispatch]]
[airsonic-ui.views.cover :refer [cover]]
[airsonic-ui.views.icon :refer [icon]]))
@ -7,8 +8,8 @@
;; currently playing / coming next / audio controls...
(defn current-song-info [song status]
[:article
[:div (:artist song) " - " (:title song)]
[:article.current-song-info
[:span (:artist song) " - " (:title song)]
;; FIXME: Sometimes items don't have a duration
[:progress.progress.is-tiny {:value (:current-time status)
:max (:duration song)}]])
@ -17,10 +18,15 @@
[:div.field.has-addons
(let [buttons [[:media-step-backward :audio-player/previous-song]
[(if is-playing? :media-pause :media-play) :audio-player/toggle-play-pause]
[:media-step-forward :audio-player/next-song]]]
[:media-step-forward :audio-player/next-song]]
title {:media-step-backward "Previous"
:media-play "Play"
:media-pause "Pause"
:media-step-forward "Next"}]
(map (fn [[icon-glyph event]]
^{:key icon-glyph} [:p.control>button.button.is-light
{:on-click (muted-dispatch [event])}
{:on-click (muted-dispatch [event])
:title (title icon-glyph)}
[icon icon-glyph]])
buttons))])
@ -41,10 +47,16 @@
repeat-button (add-classes button (case repeat-mode
:repeat-single :is-info
:repeat-all :is-primary
nil))]
nil))
repeat-title (case repeat-mode
:repeat-all "Click to repeat current track"
:repeat-single "Click to repeat all"
"Click to repeat current track")]
[:div.field.has-addons
^{:key :shuffle-button} [shuffle-button {:on-click (toggle-shuffle playback-mode)} [icon :random]]
^{:key :repeat-button} [repeat-button {:on-click (toggle-repeat-mode repeat-mode)} [icon :loop]]]))
^{:key :shuffle-button} [shuffle-button {:on-click (toggle-shuffle playback-mode)
:title "Shuffle"} [icon :random]]
^{:key :repeat-button} [repeat-button {:on-click (toggle-repeat-mode repeat-mode)
:title repeat-title} [icon :loop]]]))
(defn audio-player []
(let [current-song @(subscribe [:audio/current-song])
@ -60,7 +72,8 @@
[:div.media-left [cover current-song 48]]
[:div.media-content [current-song-info current-song playback-status]]]
[:div.level-right
[:div.buttons-start [song-controls is-playing?]]
[:div.buttons-end [playback-mode-controls playlist]]]]
[:div.button-group [:p.control>a.button.is-light {:href (routes/url-for ::routes/current-queue) :title "Go to current queue"} [icon :menu]]]
[:div.button-group [song-controls is-playing?]]
[:div.button-group [playback-mode-controls playlist]]]]
;; not playing anything
[:p.navbar-item.idle-notification "No audio playing"])]]))