mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 06:36:37 +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)
|
||||
tokens-lib (get data :tokens-lib)
|
||||
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)
|
||||
changes (-> (pcb/empty-changes it)
|
||||
(pcb/with-library-data data)
|
||||
|
@ -165,14 +169,11 @@
|
|||
name (ctob/normalize-set-name name (:name token-set))
|
||||
tokens-lib (get data :tokens-lib)]
|
||||
|
||||
(cond
|
||||
(= (:name token-set) name)
|
||||
nil
|
||||
|
||||
(ctob/get-set tokens-lib name)
|
||||
nil
|
||||
|
||||
:else
|
||||
(if (ctob/get-set tokens-lib name)
|
||||
(rx/of (ntf/show {:content (tr "errors.token-set-already-exists")
|
||||
:type :toast
|
||||
:level :error
|
||||
:timeout 9000}))
|
||||
(let [changes (-> (pcb/empty-changes it)
|
||||
(pcb/with-library-data data)
|
||||
(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"
|
||||
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
|
||||
msgid "errors.token-set-exists-on-drop"
|
||||
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"
|
||||
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