mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 19:51:41 +02: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 hide)
|
||||||
(declare show)
|
(declare show)
|
||||||
|
|
||||||
(def +animation-timeout+ 600)
|
(def default-animation-timeout 600)
|
||||||
|
(def default-timeout 2000)
|
||||||
|
|
||||||
(s/def ::type #{:success :error :info :warning})
|
(s/def ::type #{:success :error :info :warning})
|
||||||
(s/def ::position #{:fixed :floating :inline})
|
(s/def ::position #{:fixed :floating :inline})
|
||||||
|
@ -73,7 +74,7 @@
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [stoper (rx/filter (ptk/type? ::show) stream)]
|
(let [stoper (rx/filter (ptk/type? ::show) stream)]
|
||||||
(->> (rx/of #(dissoc % :message))
|
(->> (rx/of #(dissoc % :message))
|
||||||
(rx/delay +animation-timeout+)
|
(rx/delay default-animation-timeout)
|
||||||
(rx/take-until stoper))))))
|
(rx/take-until stoper))))))
|
||||||
|
|
||||||
(defn hide-tag
|
(defn hide-tag
|
||||||
|
@ -87,7 +88,7 @@
|
||||||
|
|
||||||
(defn error
|
(defn error
|
||||||
([content] (error content {}))
|
([content] (error content {}))
|
||||||
([content {:keys [timeout] :or {timeout 3000}}]
|
([content {:keys [timeout] :or {timeout default-timeout}}]
|
||||||
(show {:content content
|
(show {:content content
|
||||||
:type :error
|
:type :error
|
||||||
:position :fixed
|
:position :fixed
|
||||||
|
@ -95,7 +96,7 @@
|
||||||
|
|
||||||
(defn info
|
(defn info
|
||||||
([content] (info content {}))
|
([content] (info content {}))
|
||||||
([content {:keys [timeout] :or {timeout 3000}}]
|
([content {:keys [timeout] :or {timeout default-timeout}}]
|
||||||
(show {:content content
|
(show {:content content
|
||||||
:type :info
|
:type :info
|
||||||
:position :fixed
|
:position :fixed
|
||||||
|
@ -103,7 +104,7 @@
|
||||||
|
|
||||||
(defn success
|
(defn success
|
||||||
([content] (success content {}))
|
([content] (success content {}))
|
||||||
([content {:keys [timeout] :or {timeout 3000}}]
|
([content {:keys [timeout] :or {timeout default-timeout}}]
|
||||||
(show {:content content
|
(show {:content content
|
||||||
:type :success
|
:type :success
|
||||||
:position :fixed
|
:position :fixed
|
||||||
|
@ -111,7 +112,7 @@
|
||||||
|
|
||||||
(defn warn
|
(defn warn
|
||||||
([content] (warn content {}))
|
([content] (warn content {}))
|
||||||
([content {:keys [timeout] :or {timeout 3000}}]
|
([content {:keys [timeout] :or {timeout default-timeout}}]
|
||||||
(show {:content content
|
(show {:content content
|
||||||
:type :warning
|
:type :warning
|
||||||
:position :fixed
|
:position :fixed
|
||||||
|
|
|
@ -179,6 +179,7 @@
|
||||||
(let [{:keys [project file page frames]} data
|
(let [{:keys [project file page frames]} data
|
||||||
|
|
||||||
fullscreen (mf/use-ctx fs/fullscreen-context)
|
fullscreen (mf/use-ctx fs/fullscreen-context)
|
||||||
|
|
||||||
total (count frames)
|
total (count frames)
|
||||||
locale (mf/deref i18n/locale)
|
locale (mf/deref i18n/locale)
|
||||||
profile (mf/deref refs/profile)
|
profile (mf/deref refs/profile)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue