From 46bfb2aacda44b9c2ccc91b41d948ef04cd532a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Mon, 21 Feb 2022 13:17:46 +0100 Subject: [PATCH 1/5] :bug: Fixed alignment of layers with children --- CHANGES.md | 3 +-- common/src/app/common/geom/align.cljc | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c9791e493e..762a10f5d1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -37,8 +37,7 @@ - Fixed components get "dirty" marker when moved [Taiga #2764](https://tree.taiga.io/project/penpot/issue/2764) - Fixed cannot align objects in a group that is not part of a frame [Taiga #2762](https://tree.taiga.io/project/penpot/issue/2762) - Fix problem with double click on exit path editing [Taiga #2906](https://tree.taiga.io/project/penpot/issue/2906) - -### :arrow_up: Deps updates +- Fixed alignment of layers with children [Taiga #2862](https://tree.taiga.io/project/penpot/issue/2862) ### :heart: Community contributions by (Thank you!) diff --git a/common/src/app/common/geom/align.cljc b/common/src/app/common/geom/align.cljc index 11c8422c6c..19d91e7b27 100644 --- a/common/src/app/common/geom/align.cljc +++ b/common/src/app/common/geom/align.cljc @@ -6,7 +6,6 @@ (ns app.common.geom.align (:require - [app.common.data :as d] [app.common.geom.shapes :as gsh] [app.common.pages.helpers :refer [get-children]] [clojure.spec.alpha :as s])) @@ -20,8 +19,7 @@ (defn- recursive-move "Move the shape and all its recursive children." [shape dpoint objects] - (->> (get-children (:id shape) objects) - (map (d/getf objects)) + (->> (get-children objects (:id shape)) (cons shape) (map #(gsh/move % dpoint)))) From 70def21153dcced0b6786a6417dd5f19f366c42a Mon Sep 17 00:00:00 2001 From: Eva Date: Tue, 22 Feb 2022 11:02:04 +0100 Subject: [PATCH 2/5] :recycle: Improve file menu usage --- CHANGES.md | 2 ++ .../main/partials/workspace-header.scss | 24 +++++++++++++++++-- .../src/app/main/ui/workspace/header.cljs | 22 +++++++++++++---- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 762a10f5d1..dbc43f80aa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,8 @@ ### :boom: Breaking changes ### :sparkles: New features + +- Improve usage of file menu [Taiga #2853](https://tree.taiga.io/project/penpot/us/2853) - Rotation to snap to 15ยบ intervals with shift [Taiga #2437](https://tree.taiga.io/project/penpot/issue/2437) - Support border radius and stroke properties for images [Taiga #497](https://tree.taiga.io/project/penpot/us/497) - Disallow using same password as user email [Taiga #2454](https://tree.taiga.io/project/penpot/us/2454) diff --git a/frontend/resources/styles/main/partials/workspace-header.scss b/frontend/resources/styles/main/partials/workspace-header.scss index f2e20d65d6..3a5f1af69d 100644 --- a/frontend/resources/styles/main/partials/workspace-header.scss +++ b/frontend/resources/styles/main/partials/workspace-header.scss @@ -154,12 +154,22 @@ left: 40px; width: 183px; z-index: 12; - @include animation(0, 0.2s, fadeInDown); background-color: $color-white; border-radius: $br-small; box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.25); + :first-child { + &:hover { + border-radius: $br-small $br-small 0px 0px; + } + } + :last-child { + &:hover { + border-radius: 0px 0px $br-small $br-small; + } + } + li { cursor: pointer; font-size: $fs14; @@ -193,11 +203,21 @@ left: 230px; width: 270px; z-index: 12; - @include animation(0, 0.2s, fadeInDown); background-color: $color-white; border-radius: $br-small; box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.25); + :first-child { + &:hover { + border-radius: $br-small $br-small 0px 0px; + } + } + :last-child { + &:hover { + border-radius: 0px 0px $br-small $br-small; + } + } + &.file { top: 40px; } diff --git a/frontend/src/app/main/ui/workspace/header.cljs b/frontend/src/app/main/ui/workspace/header.cljs index 81d8a80f33..3d5169fb22 100644 --- a/frontend/src/app/main/ui/workspace/header.cljs +++ b/frontend/src/app/main/ui/workspace/header.cljs @@ -194,6 +194,13 @@ (st/emit! (dm/error (tr "errors.unexpected-error")))) (st/emitf dm/hide))))))) + on-item-hover + (mf/use-callback + (fn [item] + (fn [event] + (dom/stop-propagation event) + (reset! show-sub-menu? item)))) + on-item-click (mf/use-callback (fn [item] @@ -230,18 +237,23 @@ [:& dropdown {:show @show-menu? :on-close #(reset! show-menu? false)} [:ul.menu - [:li {:on-click (on-item-click :file)} + [:li {:on-click (on-item-click :file) + :on-pointer-enter (on-item-hover :file)} [:span (tr "workspace.header.menu.option.file")] [:span i/arrow-slide]] - [:li {:on-click (on-item-click :edit)} + [:li {:on-click (on-item-click :edit) + :on-pointer-enter (on-item-hover :edit)} [:span (tr "workspace.header.menu.option.edit")] [:span i/arrow-slide]] - [:li {:on-click (on-item-click :view)} + [:li {:on-click (on-item-click :view) + :on-pointer-enter (on-item-hover :view)} [:span (tr "workspace.header.menu.option.view")] [:span i/arrow-slide]] - [:li {:on-click (on-item-click :preferences)} + [:li {:on-click (on-item-click :preferences) + :on-pointer-enter (on-item-hover :preferences)} [:span (tr "workspace.header.menu.option.preferences")] [:span i/arrow-slide]] (when (contains? @cf/flags :user-feedback) [:* - [:li.feedback {:on-click (st/emitf (rt/nav :settings-feedback))} + [:li.feedback {:on-click (st/emitf (rt/nav :settings-feedback)) + :on-pointer-enter (st/emitf (rt/nav :settings-feedback))} [:span (tr "labels.give-feedback")]]])]] [:& dropdown {:show (= @show-sub-menu? :file) From 88706534c26483eb74f1dbed0408bb49b8f4e8bb Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 23 Feb 2022 08:33:03 +0100 Subject: [PATCH 3/5] :bug: Fixing fil typo --- frontend/translations/en.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/translations/en.po b/frontend/translations/en.po index 6db9c3e602..6ea9663f6c 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -2195,7 +2195,7 @@ msgstr "Fit - Scale down to fit" #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.zoom-fit-all" -msgstr "Zoom to fil all" +msgstr "Zoom to fit all" #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.zoom-full-screen" From 974084a9ca863a963f58b39138f3b973ba4cab22 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 23 Feb 2022 09:11:38 +0100 Subject: [PATCH 4/5] :bug: Add missing executor dependency to auth handlers --- backend/src/app/http/oauth.clj | 10 ++++++---- backend/src/app/main.clj | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/app/http/oauth.clj b/backend/src/app/http/oauth.clj index 21347f6881..17b3720686 100644 --- a/backend/src/app/http/oauth.clj +++ b/backend/src/app/http/oauth.clj @@ -24,6 +24,8 @@ [integrant.core :as ig] [promesa.exec :as px])) +;; TODO: make it fully async (?) + (defn- build-redirect-uri [{:keys [provider] :as cfg}] (let [public (u/uri (:public-uri cfg))] @@ -214,9 +216,9 @@ (redirect-response uri)))) (defn- auth-handler - [{:keys [tokens executors] :as cfg} {:keys [params] :as request} respond _] + [{:keys [tokens executor] :as cfg} {:keys [params] :as request} respond _] (px/run! - (:default executors) + executor (fn [] (let [invitation (:invitation-token params) props (extract-utm-props params) @@ -232,9 +234,9 @@ :body {:redirect-uri uri}}))))) (defn- callback-handler - [{:keys [executors] :as cfg} request respond _] + [{:keys [executor] :as cfg} request respond _] (px/run! - (:default executors) + executor (fn [] (try (let [info (retrieve-info cfg request) diff --git a/backend/src/app/main.clj b/backend/src/app/main.clj index 9eb424b6c0..6430a8e4ec 100644 --- a/backend/src/app/main.clj +++ b/backend/src/app/main.clj @@ -143,6 +143,7 @@ :pool (ig/ref :app.db/pool) :tokens (ig/ref :app.tokens/tokens) :audit (ig/ref :app.loggers.audit/collector) + :executor (ig/ref [::default :app.worker/executor]) :public-uri (cf/get :public-uri)} :app.rpc/rpc From aeed535f1b70506cbfed0461c0f76754c19bf4a3 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 23 Feb 2022 09:13:08 +0100 Subject: [PATCH 5/5] :sparkles: Minor improvement on reference handling on touched-gc task --- backend/src/app/storage.clj | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/src/app/storage.clj b/backend/src/app/storage.clj index 4891e338df..e084c46332 100644 --- a/backend/src/app/storage.clj +++ b/backend/src/app/storage.clj @@ -350,14 +350,15 @@ (retrieve-touched-chunk [conn cursor] (let [rows (->> (db/exec! conn [sql:retrieve-touched-objects-chunk cursor]) - (mapv #(d/update-when % :metadata db/decode-transit-pgobject)))] + (mapv #(d/update-when % :metadata db/decode-transit-pgobject))) + kw (fn [o] (if (keyword? o) o (keyword o)))] (when (seq rows) [(-> rows peek :created-at) ;; NOTE: we use the :file-media-object as default value for backward compatibility because when we ;; deploy it we can have old backend instances running in the same time as the new one and we can ;; still have storage-objects created without reference value. And we know that if it does not ;; have value, it means :file-media-object. - (d/group-by' #(or (-> % :metadata :reference) :file-media-object) :id rows)]))) + (d/group-by' #(or (some-> % :metadata :reference kw) :file-media-object) :id rows)]))) (retrieve-touched [conn] (->> (d/iteration (fn [cursor] @@ -391,7 +392,9 @@ (let [[f d] (case reference :file-media-object (process-objects! conn has-file-media-object-nrefs? ids) :team-font-variant (process-objects! conn has-team-font-variant-nrefs? ids) - (ex/raise :type :internal :code :unexpected-unknown-reference))] + (ex/raise :type :internal + :code :unexpected-unknown-reference + :hint (format "unknown reference %s" (pr-str reference))))] (recur (+ to-freeze f) (+ to-delete d) (rest groups)))