mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 10:38:13 -05:00
✨ Add better default for messages timeout.
This commit is contained in:
parent
64a53a68c1
commit
8ae6176242
2 changed files with 8 additions and 6 deletions
|
@ -21,7 +21,8 @@
|
|||
(declare hide)
|
||||
(declare show)
|
||||
|
||||
(def +animation-timeout+ 600)
|
||||
(def default-animation-timeout 600)
|
||||
(def default-timeout 2000)
|
||||
|
||||
(s/def ::type #{:success :error :info :warning})
|
||||
(s/def ::position #{:fixed :floating :inline})
|
||||
|
@ -73,7 +74,7 @@
|
|||
(watch [_ state stream]
|
||||
(let [stoper (rx/filter (ptk/type? ::show) stream)]
|
||||
(->> (rx/of #(dissoc % :message))
|
||||
(rx/delay +animation-timeout+)
|
||||
(rx/delay default-animation-timeout)
|
||||
(rx/take-until stoper))))))
|
||||
|
||||
(defn hide-tag
|
||||
|
@ -87,7 +88,7 @@
|
|||
|
||||
(defn error
|
||||
([content] (error content {}))
|
||||
([content {:keys [timeout] :or {timeout 3000}}]
|
||||
([content {:keys [timeout] :or {timeout default-timeout}}]
|
||||
(show {:content content
|
||||
:type :error
|
||||
:position :fixed
|
||||
|
@ -95,7 +96,7 @@
|
|||
|
||||
(defn info
|
||||
([content] (info content {}))
|
||||
([content {:keys [timeout] :or {timeout 3000}}]
|
||||
([content {:keys [timeout] :or {timeout default-timeout}}]
|
||||
(show {:content content
|
||||
:type :info
|
||||
:position :fixed
|
||||
|
@ -103,7 +104,7 @@
|
|||
|
||||
(defn success
|
||||
([content] (success content {}))
|
||||
([content {:keys [timeout] :or {timeout 3000}}]
|
||||
([content {:keys [timeout] :or {timeout default-timeout}}]
|
||||
(show {:content content
|
||||
:type :success
|
||||
:position :fixed
|
||||
|
@ -111,7 +112,7 @@
|
|||
|
||||
(defn warn
|
||||
([content] (warn content {}))
|
||||
([content {:keys [timeout] :or {timeout 3000}}]
|
||||
([content {:keys [timeout] :or {timeout default-timeout}}]
|
||||
(show {:content content
|
||||
:type :warning
|
||||
:position :fixed
|
||||
|
|
|
@ -179,6 +179,7 @@
|
|||
(let [{:keys [project file page frames]} data
|
||||
|
||||
fullscreen (mf/use-ctx fs/fullscreen-context)
|
||||
|
||||
total (count frames)
|
||||
locale (mf/deref i18n/locale)
|
||||
profile (mf/deref refs/profile)
|
||||
|
|
Loading…
Add table
Reference in a new issue