mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 02:33:39 +02:00
Start restructuring audio playback, add some tests for audio
Fixes #15 where audio was not stopped on logout
This commit is contained in:
parent
727d454871
commit
80225d46b1
10 changed files with 187 additions and 69 deletions
|
|
@ -1,18 +1,17 @@
|
|||
(ns airsonic-ui.views.bottom-bar
|
||||
(:require [re-frame.core :refer [dispatch subscribe]]
|
||||
[airsonic-ui.events :as events]
|
||||
[airsonic-ui.subs :as subs]
|
||||
[airsonic-ui.views.cover :refer [cover]]
|
||||
[airsonic-ui.views.icon :refer [icon]]))
|
||||
|
||||
;; currently playing / coming next / audio controls...
|
||||
|
||||
(defn current-song-info [{:keys [item status]}]
|
||||
(defn current-song-info [song status]
|
||||
[:article
|
||||
[:div (:artist item) " - " (:title item)]
|
||||
[:div (:artist song) " - " (:title song)]
|
||||
;; FIXME: Sometimes items don't have a duration
|
||||
[:progress.progress.is-tiny {:value (:current-time status)
|
||||
:max (:duration item)}]])
|
||||
:max (:duration song)}]])
|
||||
|
||||
(defn playback-controls [is-playing?]
|
||||
[:div.field.has-addons
|
||||
|
|
@ -25,22 +24,23 @@
|
|||
[icon icon-glyph]])
|
||||
buttons))])
|
||||
|
||||
(def logo-url "https://airsonic.github.io/airsonic-ui/assets/images/logo/airsonic-light-350x100.png")
|
||||
(def logo-url "https://airsonic.github.io/airsonic-ui/assets/images/logo/airsonic-light-350x100.png")
|
||||
|
||||
(defn bottom-bar []
|
||||
(let [currently-playing @(subscribe [::subs/currently-playing])
|
||||
is-playing? @(subscribe [::subs/is-playing?])]
|
||||
(let [current-song @(subscribe [:audio/current-song])
|
||||
playback-status @(subscribe [:audio/playback-status])
|
||||
is-playing? @(subscribe [:audio/is-playing?])]
|
||||
[:nav.navbar.is-fixed-bottom.playback-area
|
||||
[:div.navbar-brand
|
||||
[:div.navbar-item
|
||||
[:img {:src logo-url}]]]
|
||||
[:div.navbar-menu.is-active
|
||||
(if currently-playing
|
||||
(if current-song
|
||||
;; show song info
|
||||
[:section.level.audio-interaction
|
||||
[:div.level-left>article.media
|
||||
[:div.media-left [cover (:item currently-playing) 48]]
|
||||
[:div.media-content [current-song-info currently-playing]]]
|
||||
[:div.media-left [cover current-song 48]]
|
||||
[:div.media-content [current-song-info current-song playback-status]]]
|
||||
[:div.level-right [playback-controls is-playing?]]]
|
||||
;; not playing anything
|
||||
[:p.idle-notification "Currently no song selected"])]]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue