🐛 Fix title for button when trying to remove last variant property (#7017)

This commit is contained in:
luisδμ
2025-07-30 13:28:42 +02:00
committed by GitHub
parent e43b6fb0b7
commit 4d688b1d55
3 changed files with 18 additions and 7 deletions

View File

@@ -354,7 +354,7 @@
[:*
[:div {:class (stl/css :variant-property-list)}
(for [[pos prop] (map vector (range) properties)]
(for [[pos prop] (map-indexed vector properties)]
[:div {:key (str variant-id "-" pos) :class (stl/css :variant-property-container)}
[:*
[:div {:class (stl/css :variant-property-name-wrapper)}
@@ -1073,10 +1073,11 @@
(when-not multi?
[:div {:class (stl/css :variant-property-list)}
(for [[pos property] (map-indexed vector properties)]
(let [meta (->> (:value property)
(move-empty-items-to-end)
(replace {"" "--"})
(str/join ", "))]
(let [last-prop? (<= (count properties) 1)
meta (->> (:value property)
(move-empty-items-to-end)
(replace {"" "--"})
(str/join ", "))]
[:div {:key (str (:id shape) pos)
:class (stl/css :variant-property-row)}
[:> input-with-meta* {:value (:name property)
@@ -1085,11 +1086,13 @@
:data-position pos
:on-blur update-property-name}]
[:> icon-button* {:variant "ghost"
:aria-label (tr "workspace.shape.menu.remove-variant-property")
:aria-label (if last-prop?
(tr "workspace.shape.menu.remove-variant-property.last-property")
(tr "workspace.shape.menu.remove-variant-property"))
:on-click remove-property
:data-position pos
:icon "remove"
:disabled (<= (count properties) 1)}]]))])
:disabled last-prop?}]]))])
(if malformed?
[:div {:class (stl/css :variant-warning-wrapper)}

View File

@@ -6973,6 +6973,10 @@ msgstr "Remove layout"
msgid "workspace.shape.menu.remove-variant-property"
msgstr "Remove property"
#: src/app/main/ui/workspace/sidebar/options/menus/component.cljs:974
msgid "workspace.shape.menu.remove-variant-property.last-property"
msgstr "Variant should have at least one property"
#: src/app/main/ui/workspace/context_menu.cljs:318
msgid "workspace.shape.menu.rename"
msgstr "Rename"

View File

@@ -6975,6 +6975,10 @@ msgstr "Eliminar layout"
msgid "workspace.shape.menu.remove-variant-property"
msgstr "Eliminar propiedad"
#: src/app/main/ui/workspace/sidebar/options/menus/component.cljs:974
msgid "workspace.shape.menu.remove-variant-property.last-property"
msgstr "La variante debe tener al menos una propiedad"
#: src/app/main/ui/workspace/context_menu.cljs:318
msgid "workspace.shape.menu.rename"
msgstr "Renombrar"