From 38148cf87fc565864b8a9ed7d73500e3dbab64b1 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 5 Mar 2024 09:51:22 +0100 Subject: [PATCH 1/6] :bug: Fix problem with error reporting screen --- frontend/src/app/main/ui/static.cljs | 81 +++++++++++++++------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/frontend/src/app/main/ui/static.cljs b/frontend/src/app/main/ui/static.cljs index efac4c3c1..54b02f50b 100644 --- a/frontend/src/app/main/ui/static.cljs +++ b/frontend/src/app/main/ui/static.cljs @@ -69,47 +69,50 @@ (defn generate-report [data] - (let [team-id (:current-team-id @st/state) - profile-id (:profile-id @st/state) + (try + (let [team-id (:current-team-id @st/state) + profile-id (:profile-id @st/state) - trace (:app.main.errors/trace data) - instance (:app.main.errors/instance data) - content (with-out-str - (println "Hint: " (or (:hint data) (ex-message instance) "--")) - (println "Prof ID:" (str (or profile-id "--"))) - (println "Team ID:" (str (or team-id "--"))) + trace (:app.main.errors/trace data) + instance (:app.main.errors/instance data) + content (with-out-str + (println "Hint: " (or (:hint data) (ex-message instance) "--")) + (println "Prof ID:" (str (or profile-id "--"))) + (println "Team ID:" (str (or team-id "--"))) - (when-let [file-id (:file-id data)] - (println "File ID:" (str file-id))) - - (println) - - (println "Data:") - (loop [data data] - (-> (d/without-qualified data) - (dissoc :explain) - (d/update-when :data (constantly "(...)")) - (pp/pprint {:level 8 :length 10})) + (when-let [file-id (:file-id data)] + (println "File ID:" (str file-id))) (println) - (when-let [explain (:explain data)] - (print explain)) + (println "Data:") + (loop [data data] + (-> (d/without-qualified data) + (dissoc :explain) + (d/update-when :data (constantly "(...)")) + (pp/pprint {:level 8 :length 10})) - (when (and (= :server-error (:type data)) - (contains? data :data)) - (recur (:data data)))) + (println) - (println "Trace:") - (println trace) - (println) + (when-let [explain (:explain data)] + (print explain)) - (println "Last events:") - (pp/pprint @st/last-events {:length 200}) + (when (and (= :server-error (:type data)) + (contains? data :data)) + (recur (:data data)))) - (println))] + (println "Trace:") + (println trace) + (println) - (wapi/create-blob content "text/plain"))) + (println "Last events:") + (pp/pprint @st/last-events {:length 200}) + + (println))] + (wapi/create-blob content "text/plain")) + (catch :default err + (.error js/console err) + nil))) (mf/defc internal-error @@ -117,6 +120,7 @@ [{:keys [data]}] (let [on-click (mf/use-fn #(st/emit! (rt/assign-exception nil))) report-uri (mf/use-ref nil) + report (mf/use-memo (mf/deps data) #(generate-report data)) on-download (mf/use-fn @@ -125,17 +129,18 @@ (when-let [uri (mf/ref-val report-uri)] (dom/trigger-download-uri "report" "text/plain" uri))))] - (mf/with-effect [data] - (let [report (generate-report data) - uri (wapi/create-uri report)] - (mf/set-ref-val! report-uri uri) - (fn [] - (wapi/revoke-uri uri)))) + (mf/with-effect [report] + (when (some? report) + (let [uri (wapi/create-uri report)] + (mf/set-ref-val! report-uri uri) + (fn [] + (wapi/revoke-uri uri))))) [:> error-container {} [:div {:class (stl/css :main-message)} (tr "labels.internal-error.main-message")] [:div {:class (stl/css :desc-message)} (tr "labels.internal-error.desc-message")] - [:a {:on-click on-download} "Download report.txt"] + (when (some? report) + [:a {:on-click on-download} "Download report.txt"]) [:div {:class (stl/css :sign-info)} [:button {:on-click on-click} (tr "labels.retry")]]])) From ff22208ec28e2176f86584f77d33ba9cc61669f4 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 5 Mar 2024 09:55:45 +0100 Subject: [PATCH 2/6] :bug: Fix problem with grid multiple selection --- common/src/app/common/types/shape/attrs.cljc | 5 +++++ frontend/src/app/main/data/workspace/layout.cljs | 3 ++- .../src/app/main/data/workspace/shape_layout.cljs | 2 +- .../sidebar/options/menus/layout_container.cljs | 12 ++++++------ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/common/src/app/common/types/shape/attrs.cljc b/common/src/app/common/types/shape/attrs.cljc index 1f787c44a..84fc30f81 100644 --- a/common/src/app/common/types/shape/attrs.cljc +++ b/common/src/app/common/types/shape/attrs.cljc @@ -65,6 +65,11 @@ :layout-padding-type :layout-padding + :layout-grid-dir + :layout-justify-items + :layout-grid-columns + :layout-grid-rows + :layout-item-margin :layout-item-margin-type :layout-item-h-sizing diff --git a/frontend/src/app/main/data/workspace/layout.cljs b/frontend/src/app/main/data/workspace/layout.cljs index 0185c5884..24cfc6779 100644 --- a/frontend/src/app/main/data/workspace/layout.cljs +++ b/frontend/src/app/main/data/workspace/layout.cljs @@ -7,6 +7,7 @@ (ns app.main.data.workspace.layout "Workspace layout management events and helpers." (:require + [app.common.data :as d] [app.common.data.macros :as dm] [app.main.data.events :as ev] [app.util.storage :refer [storage]] @@ -123,7 +124,7 @@ ev/Event (-data [_] {::ev/origin "workspace:sidebar" - :mode (name mode)}) + :mode (d/name mode)}) ptk/UpdateEvent (update [_ state] diff --git a/frontend/src/app/main/data/workspace/shape_layout.cljs b/frontend/src/app/main/data/workspace/shape_layout.cljs index a38962aa9..19e17a5a2 100644 --- a/frontend/src/app/main/data/workspace/shape_layout.cljs +++ b/frontend/src/app/main/data/workspace/shape_layout.cljs @@ -211,7 +211,7 @@ (ptk/reify ::create-shape-layout ev/Event (-data [_] - {:layout (name type)}) + {:layout (d/name type)}) ptk/WatchEvent (watch [_ state _] 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 3a4413989..da5d9ec05 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 @@ -492,7 +492,7 @@ [:button {:class (stl/css-case :padding-toggle true :selected (= type :multiple)) - :data-type (name type) + :data-type (d/name type) :on-click on-type-change'} i/padding-extended-refactor]])) @@ -557,7 +557,7 @@ :no-validate true :placeholder "--" :data-type "row-gap" - :data-wrap-type (name wrap-type) + :data-wrap-type (d/name wrap-type) :on-focus on-gap-focus :on-change on-change' :on-blur on-gap-blur @@ -576,7 +576,7 @@ :no-validate true :placeholder "--" :data-type "column-gap" - :data-wrap-type (name wrap-type) + :data-wrap-type (d/name wrap-type) :on-focus on-gap-focus :on-change on-change' :on-blur on-gap-blur @@ -627,7 +627,7 @@ ::mf/private true} [{:keys [is-column value on-change]}] (let [type (if ^boolean is-column "column" "row")] - [:& radio-buttons {:selected (name value) + [:& radio-buttons {:selected (d/name value) :decode-fn keyword :on-change on-change :name (dm/str "flex-align-items-" type)} @@ -649,7 +649,7 @@ ::mf/private :obj} [{:keys [is-column value on-change]}] (let [type (if ^boolean is-column "column" "row")] - [:& radio-buttons {:selected (name value) + [:& radio-buttons {:selected (d/name value) :on-change on-change :decode-fn keyword :name (dm/str "grid-justify-items-" type)} @@ -811,7 +811,7 @@ [:& h/sortable-container {} [:div {:class (stl/css :grid-tracks-info-container)} (for [[index column] (d/enumerate column-values)] - [:& grid-track-info {:key (dm/str index "-" (name type)) + [:& grid-track-info {:key (dm/str index "-" (d/name type)) :type type :is-column is-column :index index From 7dec194b1f5d668aa6d5b9d9ff4f586f13d35de7 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 5 Mar 2024 10:48:14 +0100 Subject: [PATCH 3/6] :bug: Make no-clip default for new frames from shapes --- common/src/app/common/files/shapes_helpers.cljc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/files/shapes_helpers.cljc b/common/src/app/common/files/shapes_helpers.cljc index f9f814186..e07e0631a 100644 --- a/common/src/app/common/files/shapes_helpers.cljc +++ b/common/src/app/common/files/shapes_helpers.cljc @@ -122,8 +122,9 @@ (some? layout-props) (d/patch-object layout-props) + ;; Frames from shapes will not be displayed in viewer and no clipped (or (not= frame-id uuid/zero) without-fill?) - (assoc :fills [] :hide-in-viewer true))) + (assoc :fills [] :hide-in-viewer true :show-content true))) shape (with-meta shape {:index new-index}) From 335b51387d4ccdd07d57ab05d62144ad21b321b0 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 5 Mar 2024 12:11:14 +0100 Subject: [PATCH 4/6] :bug: Fix interactions with nested frames --- frontend/src/app/main/data/workspace/interactions.cljs | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/app/main/data/workspace/interactions.cljs b/frontend/src/app/main/data/workspace/interactions.cljs index 9c85ffcd3..5708ca3c4 100644 --- a/frontend/src/app/main/data/workspace/interactions.cljs +++ b/frontend/src/app/main/data/workspace/interactions.cljs @@ -215,7 +215,6 @@ target-frame (->> (ctst/get-frames-by-position objects position) - (remove :hide-in-viewer) (last))] (when (and (not= (:id target-frame) uuid/zero) From 93542282f15f7cc3d05955abd4525aa92a93c6e4 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 5 Mar 2024 14:11:57 +0100 Subject: [PATCH 5/6] :bug: Fix problem with grid gap --- .../ui/workspace/sidebar/options/menus/layout_container.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 da5d9ec05..894d92074 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 @@ -1137,7 +1137,7 @@ [:div {:class (stl/css :row :padding-section)} [:& padding-section {:value (:layout-padding values) :type (:layout-padding-type values) - :on-change-style on-padding-type-change + :on-type-change on-padding-type-change :on-change on-padding-change}]]] nil))])) @@ -1324,7 +1324,7 @@ [:div {:class (stl/css :row :padding-section)} [:& padding-section {:value (:layout-padding values) :type (:layout-padding-type values) - :on-change-style on-padding-type-change + :on-type-change on-padding-type-change :on-change on-padding-change}]] [:div {:class (stl/css :row :grid-tracks-row)} From ce68bde9a894901bc64aa70c9c8486728655d114 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 5 Mar 2024 18:13:08 +0100 Subject: [PATCH 6/6] :bug: Fix problem with detatch color in shadow --- .../src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs index 58fdad3c3..23881b43d 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs @@ -116,7 +116,7 @@ detach-color (mf/use-fn - (mf/deps ids index) + (mf/deps ids index value) (fn [_color _opacity] (when-not (string? (:color value)) (st/emit! (dch/update-shapes