mirror of
https://github.com/penpot/penpot.git
synced 2025-05-12 23:26:38 +02:00
✨ Show proper toast message on token-set rename error
This commit is contained in:
parent
1893cd306a
commit
40f69d320e
3 changed files with 16 additions and 9 deletions
|
@ -139,7 +139,11 @@
|
||||||
(let [data (dsh/lookup-file-data state)
|
(let [data (dsh/lookup-file-data state)
|
||||||
tokens-lib (get data :tokens-lib)
|
tokens-lib (get data :tokens-lib)
|
||||||
set-name (ctob/normalize-set-name set-name)]
|
set-name (ctob/normalize-set-name set-name)]
|
||||||
(when-not (ctob/get-set tokens-lib set-name)
|
(if (ctob/get-set tokens-lib set-name)
|
||||||
|
(rx/of (ntf/show {:content (tr "errors.token-set-already-exists")
|
||||||
|
:type :toast
|
||||||
|
:level :error
|
||||||
|
:timeout 9000}))
|
||||||
(let [token-set (ctob/make-token-set :name set-name)
|
(let [token-set (ctob/make-token-set :name set-name)
|
||||||
changes (-> (pcb/empty-changes it)
|
changes (-> (pcb/empty-changes it)
|
||||||
(pcb/with-library-data data)
|
(pcb/with-library-data data)
|
||||||
|
@ -165,14 +169,11 @@
|
||||||
name (ctob/normalize-set-name name (:name token-set))
|
name (ctob/normalize-set-name name (:name token-set))
|
||||||
tokens-lib (get data :tokens-lib)]
|
tokens-lib (get data :tokens-lib)]
|
||||||
|
|
||||||
(cond
|
(if (ctob/get-set tokens-lib name)
|
||||||
(= (:name token-set) name)
|
(rx/of (ntf/show {:content (tr "errors.token-set-already-exists")
|
||||||
nil
|
:type :toast
|
||||||
|
:level :error
|
||||||
(ctob/get-set tokens-lib name)
|
:timeout 9000}))
|
||||||
nil
|
|
||||||
|
|
||||||
:else
|
|
||||||
(let [changes (-> (pcb/empty-changes it)
|
(let [changes (-> (pcb/empty-changes it)
|
||||||
(pcb/with-library-data data)
|
(pcb/with-library-data data)
|
||||||
(pcb/rename-token-set (:name token-set) name))]
|
(pcb/rename-token-set (:name token-set) name))]
|
||||||
|
|
|
@ -1163,6 +1163,9 @@ msgstr "Your browser cannot do this operation"
|
||||||
msgid "errors.drop-token-set-parent-to-child"
|
msgid "errors.drop-token-set-parent-to-child"
|
||||||
msgstr "Cannot drop a parent set to an own child path."
|
msgstr "Cannot drop a parent set to an own child path."
|
||||||
|
|
||||||
|
msgid "errors.token-set-already-exists"
|
||||||
|
msgstr "A set with the same name already exists"
|
||||||
|
|
||||||
#: src/app/main/data/tokens.cljs:198
|
#: src/app/main/data/tokens.cljs:198
|
||||||
msgid "errors.token-set-exists-on-drop"
|
msgid "errors.token-set-exists-on-drop"
|
||||||
msgstr "Cannot complete drop, a set with same name already exists at path %s."
|
msgstr "Cannot complete drop, a set with same name already exists at path %s."
|
||||||
|
|
|
@ -7182,3 +7182,6 @@ msgstr "Soporte de Plugins"
|
||||||
|
|
||||||
msgid "loader.tips.10.message"
|
msgid "loader.tips.10.message"
|
||||||
msgstr "Extiende Penpot con plugins creados por la comunidad para funcionalidad extra."
|
msgstr "Extiende Penpot con plugins creados por la comunidad para funcionalidad extra."
|
||||||
|
|
||||||
|
msgid "errors.token-set-already-exists"
|
||||||
|
msgstr "Ya existe un set con el mismo nombre"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue