mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +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:
parent
187f001414
commit
ab7519f289
12 changed files with 232 additions and 42 deletions
14
src/cljs/airsonic_ui/views/notifications.cljs
Normal file
14
src/cljs/airsonic_ui/views/notifications.cljs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(ns airsonic-ui.views.notifications
|
||||
(:require [re-frame.core :refer [dispatch]]))
|
||||
|
||||
;; user notifications
|
||||
|
||||
(defn notification-list [notifications]
|
||||
[:div.notifications
|
||||
(for [[id notification] notifications]
|
||||
(let [class (case (:level notification)
|
||||
:error "danger"
|
||||
"info")]
|
||||
^{:key id} [:div {:class-name (str "notification is-small is-" class)}
|
||||
[:button.delete {:on-click #(dispatch [:notification/hide id])}]
|
||||
(:message notification)]))])
|
||||
Loading…
Add table
Add a link
Reference in a new issue