🐛 Fix error on path and review UI (#8844)

This commit is contained in:
Xaviju 2026-03-31 13:04:47 +02:00 committed by GitHub
parent 56b28b5440
commit 27313e6add
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 25 deletions

View File

@ -42,36 +42,37 @@
(not (get-in @form [:touched :name])) (not (get-in @form [:touched :name]))
(= (get-in @form [:clean-data :name]) (:name node))) (= (get-in @form [:clean-data :name]) (:name node)))
new-path (mf/with-memo [@form node] hint-path (mf/with-memo [@form node]
(let [new-name (get-in @form [:clean-data :name]) (let [new-name (get-in @form [:clean-data :name])
path (str (:path node)) path (str (:path node))
new-path (str/replace path (:name node) new-name)] new-path (str/replace path (:name node) new-name)]
new-path))] (if (get-in @form [:touched :name])
new-path
path)))]
[:* [:> fc/form* {:class (stl/css :form-wrapper)
:form form
:on-submit on-submit}
[:> heading* {:level 2 [:> heading* {:level 2
:typography "headline-medium" :typography "headline-medium"
:class (stl/css :form-modal-title)} :class (stl/css :form-modal-title)}
(tr "workspace.tokens.rename-group")] (tr "workspace.tokens.rename-group")]
[:> fc/form* {:class (stl/css :form-wrapper) [:> fc/form-input* {:id "rename-node"
:form form :name :name
:on-submit on-submit} :label (tr "workspace.tokens.token-name")
[:> fc/form-input* {:id "rename-node" :placeholder (tr "workspace.tokens.token-name")
:name :name :max-length 255
:label (tr "workspace.tokens.token-name") :variant "comfortable"
:placeholder (tr "workspace.tokens.token-name") :hint-type "hint"
:max-length 255 :hint-message (tr "workspace.tokens.rename-group-name-hint" hint-path)
:variant "comfortable" :auto-focus true}]
:hint-type "hint" [:div {:class (stl/css :form-actions)}
:hint-message (tr "workspace.tokens.rename-group-name-hint" new-path) [:> button* {:variant "secondary"
:auto-focus true}] :name "cancel"
[:div {:class (stl/css :form-actions)} :on-click on-close} (tr "labels.cancel")]
[:> button* {:variant "secondary" [:> fc/form-submit* {:variant "primary"
:name "cancel" :disabled is-disabled?
:on-click on-close} (tr "labels.cancel")] :name "rename"} (tr "labels.rename")]]]))
[:> fc/form-submit* {:variant "primary"
:disabled is-disabled?
:name "rename"} (tr "labels.rename")]]]]))
(mf/defc rename-node-modal (mf/defc rename-node-modal
{::mf/register modal/components {::mf/register modal/components

View File

@ -41,8 +41,20 @@
position: relative; position: relative;
} }
.form-wrapper {
display: flex;
flex-direction: column;
gap: var(--sp-l);
}
.form-modal-title { .form-modal-title {
@include t.use-typography("headline-medium"); @include t.use-typography("headline-medium");
color: var(--color-foreground-primary); color: var(--color-foreground-primary);
} }
.form-actions {
display: flex;
justify-content: flex-end;
gap: var(--sp-m);
}