From 0b20d85677385b2ea0636c9b8ba5bac53a5a5726 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 29 Feb 2024 11:04:20 +0100 Subject: [PATCH] :bug: Add missing option for delete grid layout on context-menu --- .../app/main/ui/workspace/context_menu.cljs | 24 ++++++++++++------- frontend/translations/en.po | 4 ++++ frontend/translations/es.po | 4 ++++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/context_menu.cljs b/frontend/src/app/main/ui/workspace/context_menu.cljs index 7e8e04784..cf566b7af 100644 --- a/frontend/src/app/main/ui/workspace/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/context_menu.cljs @@ -391,12 +391,13 @@ (mf/defc context-menu-layout {::mf/props :obj} [{:keys [shapes]}] - (let [single? (= (count shapes) 1) + (let [single? (= (count shapes) 1) - ^boolean - is-flex? (and single? - (some cfh/frame-shape? shapes) - (= :flex (:layout (first shapes)))) + has-flex? + (and single? (every? ctl/flex-layout? shapes)) + + has-grid? + (and single? (every? ctl/grid-layout? shapes)) on-add-layout (mf/use-fn @@ -414,12 +415,17 @@ (let [ids (map :id shapes)] (st/emit! (dwsl/remove-layout ids)))))] - (if is-flex? + (if (or ^boolean has-flex? + ^boolean has-grid?) [:div [:& menu-separator] - [:& menu-entry {:title (tr "workspace.shape.menu.remove-flex") - :shortcut (sc/get-tooltip :toggle-layout-flex) - :on-click on-remove-layout}]] + (if has-flex? + [:& menu-entry {:title (tr "workspace.shape.menu.remove-flex") + :shortcut (sc/get-tooltip :toggle-layout-flex) + :on-click on-remove-layout}] + [:& menu-entry {:title (tr "workspace.shape.menu.remove-grid") + :shortcut (sc/get-tooltip :toggle-layout-grid) + :on-click on-remove-layout}])] [:div [:& menu-separator] diff --git a/frontend/translations/en.po b/frontend/translations/en.po index 8ce36695b..152c70665 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -4761,6 +4761,10 @@ msgstr "Path" msgid "workspace.shape.menu.remove-flex" msgstr "Remove flex layout" +#: src/app/main/ui/workspace/context_menu.cljs +msgid "workspace.shape.menu.remove-grid" +msgstr "Remove grid layout" + #: src/app/main/ui/workspace/sidebar/options/menus/component.cljs, src/app/main/ui/workspace/sidebar/options/menus/component.cljs, src/app/main/ui/workspace/context_menu.cljs, src/app/main/ui/workspace/context_menu.cljs msgid "workspace.shape.menu.reset-overrides" msgstr "Reset overrides" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 351c85362..d86462b92 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -4837,6 +4837,10 @@ msgstr "Ruta" msgid "workspace.shape.menu.remove-flex" msgstr "Eliminar flex layout" +#: src/app/main/ui/workspace/context_menu.cljs +msgid "workspace.shape.menu.remove-grid" +msgstr "Eliminar grid layout" + #: src/app/main/ui/workspace/sidebar/options/menus/component.cljs, #: src/app/main/ui/workspace/context_menu.cljs, #: src/app/main/ui/workspace/context_menu.cljs