🐛 Fix missing create component menu for frames

This commit is contained in:
Pablo Alba 2022-12-28 12:53:37 +01:00 committed by Alejandro Alonso
parent c8bd1e89d6
commit dac11d1606
2 changed files with 13 additions and 14 deletions

View file

@ -398,7 +398,6 @@
[{:keys [shapes]}]
(let [single? (= (count shapes) 1)
has-frame? (->> shapes (d/seek cph/frame-shape?))
has-component? (some true? (map #(contains? % :component-id) shapes))
is-component? (and single? (-> shapes first :component-id some?))
@ -454,19 +453,18 @@
:accept-style :primary
:on-accept do-update-component-in-bulk}))]
[:*
(when (not has-frame?)
[:*
[:& menu-separator]
[:& menu-entry {:title (tr "workspace.shape.menu.create-component")
:shortcut (sc/get-tooltip :create-component)
:on-click do-add-component}]
(when (and has-component? (not single?))
[:*
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instances-in-bulk")
:shortcut (sc/get-tooltip :detach-component)
:on-click do-detach-component-in-bulk}]
[:& menu-entry {:title (tr "workspace.shape.menu.update-components-in-bulk")
:on-click do-update-in-bulk}]])])
[:*
[:& menu-separator]
[:& menu-entry {:title (tr "workspace.shape.menu.create-component")
:shortcut (sc/get-tooltip :create-component)
:on-click do-add-component}]
(when (and has-component? (not single?))
[:*
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instances-in-bulk")
:shortcut (sc/get-tooltip :detach-component)
:on-click do-detach-component-in-bulk}]
[:& menu-entry {:title (tr "workspace.shape.menu.update-components-in-bulk")
:on-click do-update-in-bulk}]])]
(when is-component?
;; WARNING: this menu is the same as the context menu at the sidebar.