diff --git a/frontend/src/app/main/ui/workspace/context_menu.cljs b/frontend/src/app/main/ui/workspace/context_menu.cljs index ac119cefe..9fc5c2a06 100644 --- a/frontend/src/app/main/ui/workspace/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/context_menu.cljs @@ -10,6 +10,7 @@ [app.common.data :as d] [app.common.data.macros :as dm] [app.common.pages.helpers :as cph] + [app.common.types.component :as ctk] [app.common.types.components-list :as ctkl] [app.common.types.file :as ctf] [app.common.types.page :as ctp] @@ -398,6 +399,7 @@ has-component? (some true? (map #(contains? % :component-id) shapes)) is-component? (and single? (-> shapes first :component-id some?)) + is-non-root? (and single? (ctk/in-component-instance-not-root? (first shapes))) shape-id (-> shapes first :id) component-id (-> shapes first :component-id) @@ -452,10 +454,12 @@ :on-accept do-update-component-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 (or (not is-non-root?) (and has-component? (not single?))) + [:& menu-separator]) + (when-not is-non-root? + [:& 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") @@ -468,7 +472,6 @@ ;; WARNING: this menu is the same as the context menu at the sidebar. ;; If you change it, you must change equally the file ;; app/main/ui/workspace/sidebar/options/menus/component.cljs - [:* [:& menu-separator] (if main-component?