From 9007371ab5be1967830afbf77478f447850af552 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 8 Jan 2024 15:51:28 +0100 Subject: [PATCH 1/2] :bug: Fix visual problems on inspect panel --- frontend/src/app/main/ui/viewer/inspect/code.cljs | 6 ++++-- frontend/src/app/main/ui/viewer/inspect/code.scss | 6 ++++-- frontend/src/app/main/ui/viewer/inspect/right_sidebar.scss | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/viewer/inspect/code.cljs b/frontend/src/app/main/ui/viewer/inspect/code.cljs index 205ff04f3..03afee4ac 100644 --- a/frontend/src/app/main/ui/viewer/inspect/code.cljs +++ b/frontend/src/app/main/ui/viewer/inspect/code.cljs @@ -240,7 +240,8 @@ [:button.download-button {:on-click handle-open-review} "Preview"]] - [:div {:class (stl/css :code-block)} + [:div {:class (stl/css-case :code-block true + :collapsed collapsed-css?)} [:div {:class (stl/css :code-row-lang)} [:button {:class (stl/css :toggle-btn) :data-type "css" @@ -274,7 +275,8 @@ :on-lost-pointer-capture on-style-lost-pointer-capture :on-pointer-move on-style-pointer-move}]] - [:div {:class (stl/css :code-block)} + [:div {:class (stl/css-case :code-block true + :collapsed collapsed-markup?)} [:div {:class (stl/css :code-row-lang)} [:button {:class (stl/css :toggle-btn) :data-type "markup" diff --git a/frontend/src/app/main/ui/viewer/inspect/code.scss b/frontend/src/app/main/ui/viewer/inspect/code.scss index 9f7c37b5e..1e1e58666 100644 --- a/frontend/src/app/main/ui/viewer/inspect/code.scss +++ b/frontend/src/app/main/ui/viewer/inspect/code.scss @@ -26,7 +26,6 @@ @include codeTypography; display: flex; flex-direction: column; - flex: 1; height: 100%; min-height: 0; overflow: hidden; @@ -35,7 +34,6 @@ pre { border-radius: $br-8; padding: $s-16; - max-height: var(--code-height); overflow: auto; height: 100%; } @@ -44,6 +42,10 @@ :global(.hljs) { background: $db-tertiary; } + + &.collapsed { + height: initial; + } } .code-row-lang { diff --git a/frontend/src/app/main/ui/viewer/inspect/right_sidebar.scss b/frontend/src/app/main/ui/viewer/inspect/right_sidebar.scss index c5267edbf..3074e676a 100644 --- a/frontend/src/app/main/ui/viewer/inspect/right_sidebar.scss +++ b/frontend/src/app/main/ui/viewer/inspect/right_sidebar.scss @@ -16,6 +16,7 @@ grid-area: right-sidebar; padding-top: $s-8; padding-left: $s-12; + overflow: hidden; &.viewer-code { height: calc(100vh - $s-48); } From 2705876c5669f18ab4eebfa87676fa5da2b51ef9 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 8 Jan 2024 18:10:18 +0100 Subject: [PATCH 2/2] :bug: Fix problems with drag/drop in layers --- .../main/ui/workspace/sidebar/layer_item.cljs | 31 +++++++++++++------ .../main/ui/workspace/sidebar/layer_item.scss | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs b/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs index 4cafb8a01..cb7cd5f04 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs @@ -261,16 +261,29 @@ on-drop (mf/use-fn - (mf/deps id index objects) + (mf/deps id index objects expanded?) (fn [side _data] - (let [to-index (cond + (let [shape (get objects id) + + parent-id + (cond + (= side :center) + id + + (and expanded? (= side :bot) (d/not-empty? (:shapes shape))) + id + + :else + (cfh/get-parent-id objects id)) + + parent (get objects parent-id) + + to-index (cond (= side :center) 0 + (and expanded? (= side :bot) (d/not-empty? (:shapes shape))) (count (:shapes parent)) (= side :top) (inc index) - :else index) - parent-id (if (= side :center) - id - (cfh/get-parent-id objects id)) - parent (get objects parent-id)] + :else index)] + (when-not (ctk/in-component-copy? parent) ;; We don't want to change the structure of component copies (st/emit! (dw/relocate-selected-shapes parent-id to-index)))))) @@ -308,8 +321,8 @@ depth (+ depth 1) component-tree? (or component-child? (:component-root item)) - enable-drag (mf/use-fn #(reset! drag-disabled* true)) - disable-drag (mf/use-fn #(reset! drag-disabled* false))] + enable-drag (mf/use-fn #(reset! drag-disabled* false)) + disable-drag (mf/use-fn #(reset! drag-disabled* true))] (mf/with-effect [selected? selected] (let [single? (= (count selected) 1) diff --git a/frontend/src/app/main/ui/workspace/sidebar/layer_item.scss b/frontend/src/app/main/ui/workspace/sidebar/layer_item.scss index 1fd4dde76..4f703090b 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layer_item.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/layer_item.scss @@ -51,7 +51,7 @@ border-bottom: $s-2 solid var(--layer-row-foreground-color-hover); } &.dnd-over-top { - border-bottom: $s-2 solid var(--layer-row-foreground-color-hover); + border-top: $s-2 solid var(--layer-row-foreground-color-hover); } &.dnd-over { border: $s-2 solid var(--layer-row-foreground-color-hover);