From 16788d7ab75d74b6d2f4c2c4a21bb61ab80cbf36 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 26 Jan 2022 12:41:54 +0100 Subject: [PATCH 1/7] :bug: Make a path command params property nilable on spec. --- common/src/app/common/pages/spec.cljc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/app/common/pages/spec.cljc b/common/src/app/common/pages/spec.cljc index cb642c7fc..9bd695756 100644 --- a/common/src/app/common/pages/spec.cljc +++ b/common/src/app/common/pages/spec.cljc @@ -353,7 +353,7 @@ (s/keys :req-un [:internal.shape.text/text]))) (s/def :internal.shape.path/command keyword?) -(s/def :internal.shape.path/params (s/map-of keyword? any?)) +(s/def :internal.shape.path/params (s/nilable (s/map-of keyword? any?))) (s/def :internal.shape.path/command-item (s/keys :req-un [:internal.shape.path/command :internal.shape.path/params])) From f6cf8d2b1bbd16d9ce59dd39855c7854e1940872 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 26 Jan 2022 12:56:42 +0100 Subject: [PATCH 2/7] :bug: Relax text shape content spec validation. Allow to be null in some circumstances. --- common/src/app/common/pages/spec.cljc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/common/src/app/common/pages/spec.cljc b/common/src/app/common/pages/spec.cljc index 9bd695756..90c7d024a 100644 --- a/common/src/app/common/pages/spec.cljc +++ b/common/src/app/common/pages/spec.cljc @@ -345,12 +345,13 @@ (s/def :internal.shape.text/key string?) (s/def :internal.shape.text/content - (s/or :container - (s/keys :req-un [:internal.shape.text/type - :internal.shape.text/children] - :opt-un [:internal.shape.text/key]) - :content - (s/keys :req-un [:internal.shape.text/text]))) + (s/nilable + (s/or :container + (s/keys :req-un [:internal.shape.text/type + :internal.shape.text/children] + :opt-un [:internal.shape.text/key]) + :content + (s/keys :req-un [:internal.shape.text/text])))) (s/def :internal.shape.path/command keyword?) (s/def :internal.shape.path/params (s/nilable (s/map-of keyword? any?))) From 7ac2a55315a98cb4ba39553751ed04aa26760154 Mon Sep 17 00:00:00 2001 From: Eva Date: Wed, 26 Jan 2022 08:49:57 +0100 Subject: [PATCH 3/7] :bug: Fix header z-index in viewer mode fullscreen --- frontend/resources/styles/main/layouts/handoff.scss | 12 ++++++++++-- frontend/resources/styles/main/layouts/viewer.scss | 2 +- frontend/resources/styles/main/partials/viewer.scss | 4 +++- frontend/src/app/main/ui/viewer.cljs | 3 ++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/resources/styles/main/layouts/handoff.scss b/frontend/resources/styles/main/layouts/handoff.scss index 4e06e85d0..5dfa7fefd 100644 --- a/frontend/resources/styles/main/layouts/handoff.scss +++ b/frontend/resources/styles/main/layouts/handoff.scss @@ -18,13 +18,14 @@ $width-settings-bar: 16rem; } } -.fullscreen .handoff-layout:not(.force-visible) { +.fullscreen.handoff-layout:not(.force-visible) { .viewer-header { width: 100%; position: fixed; top: -48px; left: 0; transition: top 400ms ease 300ms; + z-index: 25; &::after { content: " "; @@ -49,7 +50,14 @@ $width-settings-bar: 16rem; .handoff-layout { .viewer-section { flex-wrap: nowrap; + &.fullscreen{ + .settings-bar, + .settings-bar { + padding-top:48px; + } + } } + .settings-bar { transition: width 0.2s; &.expanded { @@ -78,7 +86,7 @@ $width-settings-bar: 16rem; .handoff-svg-container { display: grid; width: 100%; - height: calc(100% - 35px); + height: 100%; overflow: auto; align-items: center; justify-content: safe center; diff --git a/frontend/resources/styles/main/layouts/viewer.scss b/frontend/resources/styles/main/layouts/viewer.scss index f1ad747b6..28a817ad7 100644 --- a/frontend/resources/styles/main/layouts/viewer.scss +++ b/frontend/resources/styles/main/layouts/viewer.scss @@ -22,7 +22,7 @@ top: -48px; left: 0; transition: top 400ms ease 300ms; - + z-index: 1; &::after { content: " "; position: absolute; diff --git a/frontend/resources/styles/main/partials/viewer.scss b/frontend/resources/styles/main/partials/viewer.scss index c9ef5bab5..30cb96e7f 100644 --- a/frontend/resources/styles/main/partials/viewer.scss +++ b/frontend/resources/styles/main/partials/viewer.scss @@ -8,7 +8,9 @@ .viewer-section { height: calc(100vh - 48px); - + &.fullscreen{ + height: 100vh; + } grid-row: 1 / span 2; grid-column: 1 / span 1; diff --git a/frontend/src/app/main/ui/viewer.cljs b/frontend/src/app/main/ui/viewer.cljs index 068162b05..432f4ec05 100644 --- a/frontend/src/app/main/ui/viewer.cljs +++ b/frontend/src/app/main/ui/viewer.cljs @@ -234,7 +234,8 @@ :show? (:show-thumbnails local false) :page page :index index}] - [:section.viewer-section {:id "viewer-section"} + [:section.viewer-section {:id "viewer-section" + :class (if fullscreen? "fullscreen" "")} (cond (empty? frames) [:section.empty-state From 036860b91b04827e6f47f3721010e3dff570687f Mon Sep 17 00:00:00 2001 From: Eva Date: Wed, 26 Jan 2022 08:54:50 +0100 Subject: [PATCH 4/7] :bug: fix typo in zoom options --- frontend/resources/styles/main/layouts/handoff.scss | 6 +++--- frontend/resources/styles/main/partials/viewer.scss | 2 +- frontend/translations/en.po | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/resources/styles/main/layouts/handoff.scss b/frontend/resources/styles/main/layouts/handoff.scss index 5dfa7fefd..087c0c6f4 100644 --- a/frontend/resources/styles/main/layouts/handoff.scss +++ b/frontend/resources/styles/main/layouts/handoff.scss @@ -50,14 +50,14 @@ $width-settings-bar: 16rem; .handoff-layout { .viewer-section { flex-wrap: nowrap; - &.fullscreen{ + &.fullscreen { .settings-bar, .settings-bar { - padding-top:48px; + padding-top: 48px; } } } - + .settings-bar { transition: width 0.2s; &.expanded { diff --git a/frontend/resources/styles/main/partials/viewer.scss b/frontend/resources/styles/main/partials/viewer.scss index 30cb96e7f..4f9f13fe1 100644 --- a/frontend/resources/styles/main/partials/viewer.scss +++ b/frontend/resources/styles/main/partials/viewer.scss @@ -8,7 +8,7 @@ .viewer-section { height: calc(100vh - 48px); - &.fullscreen{ + &.fullscreen { height: 100vh; } grid-row: 1 / span 2; diff --git a/frontend/translations/en.po b/frontend/translations/en.po index 2def1cd26..7143899ed 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -2111,7 +2111,7 @@ msgstr "View mode (%s)" #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.zoom-fill" -msgstr "Fill -Scale to fill" +msgstr "Fill - Scale to fill" #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.zoom-fit" From ccbc519c04e0c2b3263df4e0305b93c189151a8d Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 26 Jan 2022 12:59:02 +0100 Subject: [PATCH 5/7] :lipstick: Minor cosmetic changes on internal spec naming. --- common/src/app/common/pages/spec.cljc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/pages/spec.cljc b/common/src/app/common/pages/spec.cljc index 90c7d024a..c0bc2fb2b 100644 --- a/common/src/app/common/pages/spec.cljc +++ b/common/src/app/common/pages/spec.cljc @@ -346,11 +346,11 @@ (s/def :internal.shape.text/content (s/nilable - (s/or :container + (s/or :text-container (s/keys :req-un [:internal.shape.text/type :internal.shape.text/children] :opt-un [:internal.shape.text/key]) - :content + :text-content (s/keys :req-un [:internal.shape.text/text])))) (s/def :internal.shape.path/command keyword?) From 9f7a04e330e54aa83421a48d480cf18d76c25288 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 26 Jan 2022 14:08:54 +0100 Subject: [PATCH 6/7] :bug: Fix unexpected exception on handling export data validation. --- common/src/app/common/pages/spec.cljc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/pages/spec.cljc b/common/src/app/common/pages/spec.cljc index c0bc2fb2b..1e6a020b3 100644 --- a/common/src/app/common/pages/spec.cljc +++ b/common/src/app/common/pages/spec.cljc @@ -276,8 +276,9 @@ :luminosity}) (s/def ::shape-attrs - (s/keys :req-un [::type ::name] - :opt-un [::id + (s/keys :opt-un [::id + ::type + ::name ::component-id ::component-file ::component-root? @@ -379,7 +380,11 @@ (s/and ::shape-attrs (s/keys :opt-un [:internal.shape/hide-fill-on-export]))) -(s/def ::shape (s/multi-spec shape-spec :type)) +(s/def ::shape + (s/and (s/multi-spec shape-spec :type) + #(contains? % :name) + #(contains? % :type))) + (s/def :internal.page/objects (s/map-of uuid? ::shape)) (s/def ::page From 110fb2e8db7b9b88ab57f3e1130902e851e8cb2b Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 26 Jan 2022 14:18:44 +0100 Subject: [PATCH 7/7] :sparkles: Minor improvements on error reporting. Add missing expound. --- backend/resources/templates/error-report.tmpl | 18 +++++++++++++++--- backend/src/app/http/debug.clj | 6 +++--- backend/src/app/http/errors.clj | 3 +++ common/src/app/common/logging.cljc | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/backend/resources/templates/error-report.tmpl b/backend/resources/templates/error-report.tmpl index bf9748862..a3fcc158d 100644 --- a/backend/resources/templates/error-report.tmpl +++ b/backend/resources/templates/error-report.tmpl @@ -9,6 +9,12 @@ penpot - error report {{id}}
[]
+ {% if data %} + + {% endif %} + {% if spec-explain %} + + {% endif %} {% if spec-problems %} {% endif %} @@ -16,9 +22,6 @@ penpot - error report {{id}} {% endif %} - {% if data %} - - {% endif %} {% if trace %} {% endif %} @@ -55,6 +58,15 @@ penpot - error report {{id}} {% endif %} + {% if spec-explain %} +
+
SPEC EXPLAIN:
+
+
{{spec-explain}}
+
+
+ {% endif %} + {% if spec-problems %}
SPEC PROBLEMS:
diff --git a/backend/src/app/http/debug.clj b/backend/src/app/http/debug.clj index 39e597343..2098cd084 100644 --- a/backend/src/app/http/debug.clj +++ b/backend/src/app/http/debug.clj @@ -150,14 +150,14 @@ (binding [ppr/*print-right-margin* 300] (let [context (dissoc report :trace :cause :params :data :spec-problems - :spec-value :error :explain :hint) + :spec-explain :spec-value :error :explain :hint) params {:context (with-out-str (ppr/pprint context)) :hint (:hint report) + :spec-explain (:spec-explain report) :spec-problems (:spec-problems report) :spec-value (:spec-value report) :data (:data report) - :trace (or (:cause report) - (:trace report) + :trace (or (:trace report) (some-> report :error :trace)) :params (:params report)}] (-> (io/resource "templates/error-report.tmpl") diff --git a/backend/src/app/http/errors.clj b/backend/src/app/http/errors.clj index 216fe9127..e8686d87c 100644 --- a/backend/src/app/http/errors.clj +++ b/backend/src/app/http/errors.clj @@ -12,6 +12,7 @@ [app.common.uuid :as uuid] [clojure.pprint] [clojure.spec.alpha :as s] + [expound.alpha :as expound] [cuerdas.core :as str])) (defn- parse-client-ip @@ -31,6 +32,8 @@ :params (:params request) :spec-problems (some-> data ::s/problems) :spec-value (some-> data ::s/value) + :spec-explain (with-out-str + (expound/printer data)) :data (some-> data (dissoc ::s/problems ::s/value :hint)) :ip-addr (parse-client-ip request) :profile-id (:profile-id request)} diff --git a/common/src/app/common/logging.cljc b/common/src/app/common/logging.cljc index 6800253c3..aea40b935 100644 --- a/common/src/app/common/logging.cljc +++ b/common/src/app/common/logging.cljc @@ -180,7 +180,7 @@ `(->> (ThreadContext/getImmutableContext) (send-off logging-agent (fn [_# cdata#] - (with-context (into {:cause ~cause} cdata#) + (with-context (into {} cdata#) (->> (or ~raw (build-map-message ~props)) (write-log! ~logger-sym ~level-sym ~cause))))))