diff --git a/frontend/src/app/main/data/common.cljs b/frontend/src/app/main/data/common.cljs index 064d1901d5..713c5d1989 100644 --- a/frontend/src/app/main/data/common.cljs +++ b/frontend/src/app/main/data/common.cljs @@ -73,7 +73,7 @@ (st/emit! (ntf/hide))) (defn handle-notification - [{:keys [message code level] :as params}] + [{:keys [message code] :as params}] (ptk/reify ::show-notification ptk/WatchEvent (watch [_ _ _] @@ -81,9 +81,6 @@ :upgrade-version (rx/of (ntf/dialog :content (tr "notifications.by-code.upgrade-version") - :controls :inline-actions - :type :inline - :level level :accept {:label (tr "labels.refresh") :callback force-reload!} :tag :notification)) @@ -91,16 +88,14 @@ :maintenance (rx/of (ntf/dialog :content (tr "notifications.by-code.maintenance") - :controls :inline-actions - :type level :accept {:label (tr "labels.accept") :callback hide-notifications!} :tag :notification)) (rx/of (ntf/dialog :content message - :controls :close - :type level + :accept {:label (tr "labels.close") + :callback hide-notifications!} :tag :notification)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/frontend/src/app/main/data/notifications.cljs b/frontend/src/app/main/data/notifications.cljs index 37caee0ba2..5c0082bec3 100644 --- a/frontend/src/app/main/data/notifications.cljs +++ b/frontend/src/app/main/data/notifications.cljs @@ -19,7 +19,7 @@ (def ^:private schema:notification [:map {:title "Notification"} - [:level [::sm/one-of #{:success :error :info :warning}]] + [:level {:optional true} [::sm/one-of #{:success :error :info :warning}]] [:status {:optional true} [::sm/one-of #{:visible :hide}]] [:position {:optional true} @@ -129,15 +129,11 @@ :timeout timeout}))) (defn dialog - [& {:keys [content controls actions accept cancel position tag level links] - :or {controls :none position :floating level :info}}] + [& {:keys [content accept cancel tag links]}] (show (d/without-nils {:content content - :level level - :links links - :position position - :controls controls - :actions actions + :type :inline :accept accept :cancel cancel + :links links :tag tag}))) diff --git a/frontend/src/app/main/data/workspace/notifications.cljs b/frontend/src/app/main/data/workspace/notifications.cljs index e62985f70b..dc46e6e355 100644 --- a/frontend/src/app/main/data/workspace/notifications.cljs +++ b/frontend/src/app/main/data/workspace/notifications.cljs @@ -65,7 +65,6 @@ (->> (rx/from initmsg) (rx/map dws/send)) - ;; Subscribe to notifications of the subscription (->> stream (rx/filter (ptk/type? ::dws/message)) diff --git a/frontend/src/app/main/ui.cljs b/frontend/src/app/main/ui.cljs index f751232397..f67fb755a3 100644 --- a/frontend/src/app/main/ui.cljs +++ b/frontend/src/app/main/ui.cljs @@ -370,6 +370,6 @@ (if edata [:> static/exception-page* {:data edata :route route}] [:> error-boundary* {:fallback static/internal-error*} - [:& notifications/current-notification] + [:> notifications/current-notification*] (when route [:> page* {:route route :profile profile}])])]])) diff --git a/frontend/src/app/main/ui/notifications.cljs b/frontend/src/app/main/ui/notifications.cljs index 5f19792d64..e78ac74944 100644 --- a/frontend/src/app/main/ui/notifications.cljs +++ b/frontend/src/app/main/ui/notifications.cljs @@ -14,10 +14,10 @@ [okulary.core :as l] [rumext.v2 :as mf])) -(def ref:notification +(def ^:private ref:notification (l/derived :notification st/state)) -(mf/defc current-notification +(mf/defc current-notification* [] (let [notification (mf/deref ref:notification) on-close (mf/use-fn #(st/emit! (ntf/hide)))