mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Change icon based on volume level
This commit is contained in:
parent
51372d3e7f
commit
6e1664327f
2 changed files with 20 additions and 12 deletions
|
|
@ -93,7 +93,7 @@
|
|||
|
||||
(rf/reg-sub
|
||||
:audio/playlist
|
||||
(fn [_ _] (rf/subscribe [:audio/summary]))
|
||||
:<- [:audio/summary]
|
||||
playlist)
|
||||
|
||||
(defn current-song
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
|
||||
(rf/reg-sub
|
||||
:audio/current-song
|
||||
(fn [_ _] (rf/subscribe [:audio/playlist]))
|
||||
:<- [:audio/playlist]
|
||||
current-song)
|
||||
|
||||
(defn playback-status
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
|
||||
(rf/reg-sub
|
||||
:audio/playback-status
|
||||
(fn [_ _] (rf/subscribe [:audio/summary]))
|
||||
:<- [:audio/summary]
|
||||
playback-status)
|
||||
|
||||
(defn is-playing?
|
||||
|
|
@ -125,5 +125,5 @@
|
|||
|
||||
(rf/reg-sub
|
||||
:audio/is-playing?
|
||||
(fn [_ _] (rf/subscribe [:audio/playback-status]))
|
||||
:<- [:audio/playback-status]
|
||||
is-playing?)
|
||||
|
|
|
|||
|
|
@ -104,15 +104,23 @@
|
|||
:on-mouse-move #(when (= 1 (.-buttons %))
|
||||
(set-volume %))}]]))
|
||||
|
||||
(def toggle-volume-slider #(swap! volume-slider-visible? not))
|
||||
(def hide-volume-slider #(reset! volume-slider-visible? false))
|
||||
|
||||
(defn volume-controls [playback-status]
|
||||
(let [volume (:volume playback-status)
|
||||
volume-icon (cond
|
||||
(> volume 0.66) :volume-high
|
||||
(> volume 0.1) :volume-low
|
||||
:else :volume-off)]
|
||||
[:div.button-controls.volume-controls
|
||||
(when @volume-slider-visible?
|
||||
[:div.button-menu
|
||||
[:div.button-menu-closer {:on-click #(reset! volume-slider-visible? false)}]
|
||||
[volume-slider (:volume playback-status)]])
|
||||
[:div.button-menu-closer {:on-click hide-volume-slider}]
|
||||
[volume-slider volume]])
|
||||
[:p.control>button.button.is-light
|
||||
{:on-click #(swap! volume-slider-visible? not)}
|
||||
[icon :volume-high]]])
|
||||
{:on-click toggle-volume-slider}
|
||||
[icon volume-icon]]]))
|
||||
|
||||
(defn playback-mode-controls [playlist]
|
||||
(let [{:keys [repeat-mode playback-mode]} playlist
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue