🐛 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
2 changed files with 38 additions and 25 deletions

View File

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

View File

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