mirror of https://github.com/penpot/penpot.git
🐛 Fix error on shadow token creation (#8029)
This commit is contained in:
parent
fb9560c315
commit
743d4e5c8d
|
|
@ -349,6 +349,7 @@
|
|||
(let [form (mf/use-ctx fc/context)
|
||||
input-name name
|
||||
|
||||
|
||||
error
|
||||
(get-in @form [:errors :value value-subfield index input-name])
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
[token index prop value-subfield]
|
||||
(let [value (get-in token [:value value-subfield index prop])]
|
||||
(d/without-nils
|
||||
{:type (if (= prop :color) :color :number)
|
||||
{:type (if (= prop :color) :color :dimensions)
|
||||
:value value})))
|
||||
|
||||
(mf/defc shadow-formset*
|
||||
|
|
@ -274,8 +274,20 @@
|
|||
[:map
|
||||
[:offset-x {:optional true} [:maybe :string]]
|
||||
[:offset-y {:optional true} [:maybe :string]]
|
||||
[:blur {:optional true} [:maybe :string]]
|
||||
[:spread {:optional true} [:maybe :string]]
|
||||
[:blur {:optional true}
|
||||
[:and
|
||||
[:maybe :string]
|
||||
[:fn {:error/fn #(tr "workspace.tokens.shadow-token-blur-value-error")}
|
||||
(fn [blur]
|
||||
(let [n (d/parse-double blur)]
|
||||
(or (nil? n) (not (< n 0)))))]]]
|
||||
[:spread {:optional true}
|
||||
[:and
|
||||
[:maybe :string]
|
||||
[:fn {:error/fn #(tr "workspace.tokens.shadow-token-spread-value-error")}
|
||||
(fn [spread]
|
||||
(let [n (d/parse-double spread)]
|
||||
(or (nil? n) (not (< n 0)))))]]]
|
||||
[:color {:optional true} [:maybe :string]]
|
||||
[:color-result {:optional true} ::sm/any]
|
||||
[:inset {:optional true} [:maybe :boolean]]]]]
|
||||
|
|
|
|||
|
|
@ -47,17 +47,18 @@
|
|||
[acc {:keys [schema in value type] :as problem}]
|
||||
(let [props (m/properties schema)
|
||||
tprops (m/type-properties schema)
|
||||
field (or (first in)
|
||||
(:error/field props))
|
||||
|
||||
field (or (:error/field props)
|
||||
in)
|
||||
field (if (vector? field)
|
||||
field
|
||||
[field])]
|
||||
|
||||
(if (contains? acc field)
|
||||
(if (and (= 1 (count field))
|
||||
(contains? acc (first field)))
|
||||
acc
|
||||
(cond
|
||||
(nil? field)
|
||||
(or (nil? field)
|
||||
(empty? field))
|
||||
acc
|
||||
|
||||
(or (= type :malli.core/missing-key)
|
||||
|
|
|
|||
|
|
@ -8032,6 +8032,14 @@ msgstr "Name"
|
|||
msgid "workspace.tokens.token-name-duplication-validation-error"
|
||||
msgstr "A token already exists at the path: %s"
|
||||
|
||||
#: src/app/main/ui/workspace/tokens/management/forms/shadow.cljs
|
||||
msgid "workspace.tokens.shadow-token-blur-value-error"
|
||||
msgstr "Blur value cannot be negative"
|
||||
|
||||
#: src/app/main/ui/workspace/tokens/management/forms/shadow.cljs
|
||||
msgid "workspace.tokens.shadow-token-spread-value-error"
|
||||
msgstr "Spread value cannot be negative"
|
||||
|
||||
#: src/app/main/ui/workspace/tokens/management/create/border_radius.cljs:42, src/app/main/ui/workspace/tokens/management/create/form.cljs:68
|
||||
msgid "workspace.tokens.token-name-length-validation-error"
|
||||
msgstr "Name should be at least 1 character"
|
||||
|
|
|
|||
|
|
@ -7908,6 +7908,14 @@ msgstr "Nombre"
|
|||
msgid "workspace.tokens.token-name-duplication-validation-error"
|
||||
msgstr "Ya existe un token en la ruta: %s"
|
||||
|
||||
#: src/app/main/ui/workspace/tokens/management/forms/shadow.cljs
|
||||
msgid "workspace.tokens.shadow-token-blur-value-error"
|
||||
msgstr "El valor de blur no puede ser negativo"
|
||||
|
||||
#: src/app/main/ui/workspace/tokens/management/forms/shadow.cljs
|
||||
msgid "workspace.tokens.shadow-token-spread-value-error"
|
||||
msgstr "El valor de spread no puede ser negativo"
|
||||
|
||||
#: src/app/main/ui/workspace/tokens/management/create/border_radius.cljs:42, src/app/main/ui/workspace/tokens/management/create/form.cljs:68
|
||||
msgid "workspace.tokens.token-name-length-validation-error"
|
||||
msgstr "El nombre debería ser de al menos 1 caracter"
|
||||
|
|
|
|||
Loading…
Reference in New Issue