From 338b6cdbd60e303ecd1b9d705d2e7524ad4411d2 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 11 Mar 2024 16:01:28 +0100 Subject: [PATCH 1/5] :bug: Add tooltip to button in layout --- .../ui/workspace/sidebar/options/menus/layout_container.cljs | 1 + frontend/translations/en.po | 3 +++ frontend/translations/es.po | 3 +++ 3 files changed, 7 insertions(+) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs index fc31dc4f0..b7a5dde44 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs @@ -480,6 +480,7 @@ [:button {:class (stl/css-case :padding-toggle true :selected (= type :multiple)) + :title (tr "workspace.layout_grid.editor.padding.expand") :data-type (d/name type) :on-click on-type-change'} i/padding-extended]])) diff --git a/frontend/translations/en.po b/frontend/translations/en.po index df15b1c17..d4b3e9527 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -3520,6 +3520,9 @@ msgstr "Edit grid" msgid "workspace.layout_grid.editor.options.exit" msgstr "Exit" +msgid "workspace.layout_grid.editor.padding.expand" +msgstr "Show 4 sided padding options" + #: src/app/main/ui/workspace/libraries.cljs msgid "workspace.libraries.add" msgstr "Add" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 5ce93d9b9..e2072c81d 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -3582,6 +3582,9 @@ msgstr "Editar rejilla" msgid "workspace.layout_grid.editor.options.exit" msgstr "Salir" +msgid "workspace.layout_grid.editor.padding.expand" +msgstr "Mostrar el padding a 4 lados" + #: src/app/main/ui/workspace/libraries.cljs msgid "workspace.libraries.add" msgstr "AƱadir" From 112e71a259acc44a5378b66867c597d98f102ab1 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 11 Mar 2024 16:01:53 +0100 Subject: [PATCH 2/5] :bug: Fix propagation of auto/fix sizing on components --- .../data/workspace/libraries_helpers.cljs | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/workspace/libraries_helpers.cljs b/frontend/src/app/main/data/workspace/libraries_helpers.cljs index 296cd7c92..75fb6945a 100644 --- a/frontend/src/app/main/data/workspace/libraries_helpers.cljs +++ b/frontend/src/app/main/data/workspace/libraries_helpers.cljs @@ -1521,11 +1521,26 @@ (defn- update-flex-child-copy-attrs "Synchronizes the attributes inside the flex-child items (main->copy)" - [changes _shape-main shape-copy main-container main-component copy-container omit-touched?] + [changes shape-main shape-copy main-container main-component copy-container omit-touched?] + (let [new-changes (-> (pcb/empty-changes) (pcb/with-container copy-container) (pcb/with-objects (:objects copy-container)) + + ;; The layout-item-sizing needs to be update when the parent is auto or fix + (pcb/update-shapes + [(:id shape-copy)] + (fn [shape-copy] + (cond-> shape-copy + (contains? #{:auto :fix} (:layout-item-h-sizing shape-main)) + (propagate-attrs shape-main #{:layout-item-h-sizing} omit-touched?) + + (contains? #{:auto :fix} (:layout-item-h-sizing shape-main)) + (propagate-attrs shape-main #{:layout-item-v-sizing} omit-touched?))) + {:ignore-touched true}) + + ;; Update the child flex properties from the parent (pcb/update-shapes (:shapes shape-copy) (fn [child-copy] @@ -1542,6 +1557,20 @@ (-> (pcb/empty-changes) (pcb/with-page main-container) (pcb/with-objects (:objects main-container)) + + ;; The layout-item-sizing needs to be update when the parent is auto or fix + (pcb/update-shapes + [(:id shape-main)] + (fn [shape-main] + (cond-> shape-main + (contains? #{:auto :fix} (:layout-item-h-sizing shape-copy)) + (propagate-attrs shape-copy #{:layout-item-h-sizing} omit-touched?) + + (contains? #{:auto :fix} (:layout-item-h-sizing shape-copy)) + (propagate-attrs shape-copy #{:layout-item-v-sizing} omit-touched?))) + {:ignore-touched true}) + + ;; Updates the children properties from the parent (pcb/update-shapes (:shapes shape-main) (fn [child-main] @@ -1620,4 +1649,3 @@ (if (cfh/page? container) (assoc change :page-id (:id container)) (assoc change :component-id (:id container)))) - From bed13c24dfcb23a510441e964df81444f399a9df Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 11 Mar 2024 16:13:36 +0100 Subject: [PATCH 3/5] :bug: Fix problem with comments new line --- frontend/src/app/main/ui/comments.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/app/main/ui/comments.scss b/frontend/src/app/main/ui/comments.scss index ddad36a6b..12890644d 100644 --- a/frontend/src/app/main/ui/comments.scss +++ b/frontend/src/app/main/ui/comments.scss @@ -196,6 +196,7 @@ position: relative; .text { @include bodySmallTypography; + white-space: pre; } } } From de1dae7f9386a88930016cf8e637cd4aaed3d6df Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 11 Mar 2024 16:53:53 +0100 Subject: [PATCH 4/5] :bug: Fix problem with input fast change --- .../src/app/main/ui/components/numeric_input.cljs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/main/ui/components/numeric_input.cljs b/frontend/src/app/main/ui/components/numeric_input.cljs index 308ef8e42..54965605e 100644 --- a/frontend/src/app/main/ui/components/numeric_input.cljs +++ b/frontend/src/app/main/ui/components/numeric_input.cljs @@ -152,7 +152,7 @@ handle-key-down (mf/use-fn - (mf/deps set-delta apply-value update-input) + (mf/deps set-delta apply-value update-input parse-value) (fn [event] (mf/set-ref-val! dirty-ref true) (let [up? (kbd/up-arrow? event) @@ -162,19 +162,13 @@ node (mf/ref-val ref)] (when (or up? down?) (set-delta event up? down?)) + (reset! last-value* (parse-value)) (when enter? (dom/blur! node)) (when esc? (update-input value-str) (dom/blur! node))))) - handle-key-up - (mf/use-fn - (mf/deps parse-value) - (fn [] - ;; Store the last value inputed - (reset! last-value* (parse-value)))) - handle-mouse-wheel (mf/use-fn (mf/deps set-delta) @@ -231,7 +225,6 @@ (obj/set! "defaultValue" (fmt/format-number value)) (obj/set! "title" title) (obj/set! "onKeyDown" handle-key-down) - (obj/set! "onKeyUp" handle-key-up) (obj/set! "onBlur" handle-blur) (obj/set! "onFocus" handle-focus))] From 9852558a57eec99298c4502a44bba4e8b726efcc Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 11 Mar 2024 18:11:18 +0100 Subject: [PATCH 5/5] :bug: Fix problem when importing templates --- .../src/app/main/ui/dashboard/import.cljs | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/main/ui/dashboard/import.cljs b/frontend/src/app/main/ui/dashboard/import.cljs index d51195184..14f0318e3 100644 --- a/frontend/src/app/main/ui/dashboard/import.cljs +++ b/frontend/src/app/main/ui/dashboard/import.cljs @@ -345,18 +345,21 @@ edition* (mf/use-state nil) edition (deref edition*) + template-finished* (mf/use-state nil) + template-finished (deref template-finished*) + on-template-cloned-success (mf/use-fn (fn [] - (swap! status* (constantly :importing)) - ;; (swap! state assoc :status :importing :importing-templates 0) + (reset! status* :importing) + (reset! template-finished* true) (st/emit! (dd/fetch-recent-files)))) on-template-cloned-error (mf/use-fn (fn [cause] - (swap! status* (constantly :error)) - ;; (swap! state assoc :status :error :importing-templates 0) + (reset! status* :error) + (reset! template-finished* true) (errors/print-error! cause) (rx/of (modal/hide) (msg/error (tr "dashboard.libraries-and-templates.import-error"))))) @@ -434,15 +437,29 @@ 1 (count (filterv has-status-success? entries))) - errors? (or (some has-status-error? entries) - (zero? (count entries))) - + errors? (if (some? template) + (= status :error) + (or (some has-status-error? entries) + (zero? (count entries)))) pending-analysis? (some has-status-analyzing? entries) - pending-import? (pos? num-importing) - valid-all-entries? (or (some? template) - (not (some has-status-analyze-error? entries)))] + pending-import? (and (or (nil? template) + (not template-finished)) + (pos? num-importing)) + valid-all-entries? (or (some? template) + (not (some has-status-analyze-error? entries))) + + template-status + (cond + (and (= :importing status) pending-import?) + :importing + + (and (= :importing status) (not ^boolean pending-import?)) + :import-finish + + :else + :ready)] ;; Run analyze operation on component mount (mf/with-effect [] @@ -486,7 +503,7 @@ :can-be-deleted (> (count entries) 1)}]) (when (some? template) - [:& import-entry {:entry (assoc template :status :ready) + [:& import-entry {:entry (assoc template :status template-status) :can-be-deleted false}])] [:div {:class (stl/css :modal-footer)}