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

Add user notifications and display api errors (#10)

Closes #2 

* Add user notifications

* Update re-frame-10x config

* Display api errors as notifications

* Automatically hide notifications after a while
This commit is contained in:
Arne Schlüter 2018-06-11 19:58:13 +02:00 committed by GitHub
commit ab7519f289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 232 additions and 42 deletions

View file

@ -6,40 +6,38 @@
;; FIXME: this is used for cover images and it's quite ugly tbh
(re-frame/reg-sub
::login
(fn [db]
(fn [db _]
(select-keys (:credentials db) [:u :p])))
(re-frame/reg-sub
::user
(fn [{:keys [credentials]}]
(fn [{:keys [credentials]} [_]]
{:name (:u credentials)}))
(re-frame/reg-sub
::server
(fn [db]
(fn [db _]
(get-in db [:credentials :server])))
;; current hashbang
(re-frame/reg-sub
::current-route
(fn [db]
(fn [db _]
(:current-route db)))
;; ---
;; TODO: Make this nice and clean
(re-frame/reg-sub
::current-content
(fn [db]
(db :response)))
(fn [db _]
(:response db)))
(re-frame/reg-sub
; returns info on the current song as is (basically the metadata you can read from the file system)
::currently-playing
(fn [db]
(db :currently-playing)))
(fn [db _]
(:currently-playing db)))
(re-frame/reg-sub
::is-playing?
@ -49,3 +47,10 @@
(let [status (:status currently-playing)]
(and (not (:paused? status))
(not (:ended? status))))))
;; user notifications
(re-frame/reg-sub
::notifications
(fn [db _]
(:notifications db)))