From 293ab3c80e3dc61304269df4bc6a01663587ff61 Mon Sep 17 00:00:00 2001 From: AzazelN28 Date: Thu, 18 Apr 2024 12:14:29 +0200 Subject: [PATCH 1/9] :bug: Fix color palette sorting --- CHANGES.md | 3 ++ .../ui/workspace/colorpicker/libraries.cljs | 30 ++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 100296f4d..3df22277a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,9 @@ - Fix locking contention on cron subsystem (causes backend start blocking) - Fix locking contention on file object thumbails backend RPC calls +### :bug: Bugs fixed + +- Fix color palette sorting [Taiga Issue #7458](https://tree.taiga.io/project/penpot/issue/7458) ## 2.0.1 diff --git a/frontend/src/app/main/ui/workspace/colorpicker/libraries.cljs b/frontend/src/app/main/ui/workspace/colorpicker/libraries.cljs index 14e851d31..9bb4f067e 100644 --- a/frontend/src/app/main/ui/workspace/colorpicker/libraries.cljs +++ b/frontend/src/app/main/ui/workspace/colorpicker/libraries.cljs @@ -7,6 +7,7 @@ (ns app.main.ui.workspace.colorpicker.libraries (:require-macros [app.main.style :as stl]) (:require + [app.common.colors :as c] [app.common.data :as d] [app.common.data.macros :as dm] [app.main.data.events :as ev] @@ -24,7 +25,7 @@ [rumext.v2 :as mf])) (mf/defc libraries - [{:keys [state on-select-color on-add-library-color disable-gradient disable-opacity disable-image]}] + [{:keys [state on-select-color on-add-library-color disable-gradient disable-opacity disable-image]}] (let [selected (h/use-shared-state mdc/colorpicker-selected-broadcast-key :recent) current-colors (mf/use-state []) @@ -43,10 +44,23 @@ (parse-uuid event))))) check-valid-color? - (fn [color] - (and (or (not disable-gradient) (not (:gradient color))) - (or (not disable-opacity) (= 1 (:opacity color))) - (or (not disable-image) (not (:image color))))) + (mf/use-fn + (fn [color] + (and (or (not disable-gradient) (not (:gradient color))) + (or (not disable-opacity) (= 1 (:opacity color))) + (or (not disable-image) (not (:image color)))))) + + ;; Sort colors by hue and lightness + get-sorted-colors + (mf/use-fn + (fn [colors] + (sort (fn [a b] + (let [[ah _ al] (c/hex->hsl (:color a)) + [bh _ bl] (c/hex->hsl (:color b)) + a (+ (* ah 100) (* al 99)) + b (+ (* bh 100) (* bl 99))] + (compare a b))) + (into [] (filter check-valid-color?) colors)))) toggle-palette (mf/use-fn @@ -89,13 +103,15 @@ (sort-by :name) (map #(assoc % :file-id file-id)))))] - (reset! current-colors (into [] (filter check-valid-color?) colors)))) + (if (not= @selected :recent) + (reset! current-colors (get-sorted-colors colors)) + (reset! current-colors (into [] (filter check-valid-color? colors)))))) ;; If the file colors change and the file option is selected updates the state (mf/with-effect [file-colors] (when (= @selected :file) (let [colors (vals file-colors)] - (reset! current-colors (into [] (filter check-valid-color?) colors))))) + (reset! current-colors (get-sorted-colors colors))))) [:div {:class (stl/css :libraries)} [:div {:class (stl/css :select-wrapper)} From c6fabc349ea3d6f4481b7dc7128a53eed1f0a682 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Mon, 22 Apr 2024 10:46:35 +0200 Subject: [PATCH 2/9] :bug: Fix swap-slot is removed on copy-paste of a chained copy --- frontend/src/app/main/data/workspace/selection.cljs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 8ce2cfe1f..b233f561d 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -486,6 +486,7 @@ duplicating-component? (or duplicating-component? (ctk/instance-head? obj)) is-component-main? (ctk/main-instance? obj) subinstance-head? (ctk/subinstance-head? obj) + instance-root? (ctk/instance-root? obj) into-component? (and duplicating-component? (ctn/in-any-component? objects parent)) @@ -508,7 +509,9 @@ :parent-id parent-id :frame-id frame-id) - (cond-> (and subinstance-head? remove-swap-slot?) + (cond-> (and (not instance-root?) + subinstance-head? + remove-swap-slot?) (ctk/remove-swap-slot)) (dissoc :shapes @@ -581,8 +584,9 @@ true (and remove-swap-slot? ;; only remove swap slot of children when the current shape - ;; is not a subinstance head - (not subinstance-head?)))) + ;; is not a subinstance head nor a instance root + (not subinstance-head?) + (not instance-root?)))) changes (map (d/getf objects) (:shapes obj))))))) From 2a752e36250ebc288a74b80d235dbc9afba699d2 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Mon, 22 Apr 2024 11:22:25 +0200 Subject: [PATCH 3/9] :bug: swap slot is not copied on copy-paste of a main --- common/src/app/common/types/container.cljc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/types/container.cljc b/common/src/app/common/types/container.cljc index b50c5058a..d038ca50c 100644 --- a/common/src/app/common/types/container.cljc +++ b/common/src/app/common/types/container.cljc @@ -386,7 +386,8 @@ (fn [new-shape original-shape] (let [new-name (:name new-shape) root? (or (ctk/instance-root? original-shape) ; If shape is inside a component (not components-v2) - (nil? (:parent-id original-shape)))] ; we detect it by having no parent) + (nil? (:parent-id original-shape))) ; we detect it by having no parent) + swap-slot (ctk/get-swap-slot original-shape)] (when root? (vswap! unames conj new-name)) @@ -398,6 +399,9 @@ (-> (gsh/move delta) (dissoc :touched)) + (some? swap-slot) + (assoc :touched #{(ctk/build-swap-slot-group swap-slot)}) + (and main-instance? root?) (assoc :main-instance true) From 908229b7a8f9da0772fe7a73ef7d83aecc234e57 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 22 Apr 2024 13:04:48 +0200 Subject: [PATCH 4/9] :bug: Fix librares and templates links --- frontend/src/app/main/ui/dashboard/templates.cljs | 2 +- frontend/src/app/main/ui/releases/v1_9.cljs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/dashboard/templates.cljs b/frontend/src/app/main/ui/dashboard/templates.cljs index f7a42454f..8927ff053 100644 --- a/frontend/src/app/main/ui/dashboard/templates.cljs +++ b/frontend/src/app/main/ui/dashboard/templates.cljs @@ -155,7 +155,7 @@ [:div {:class (stl/css :img-container)} [:a {:id id :tab-index (if (or (not is-visible) collapsed) "-1" "0") - :href "https://penpot.app/libraries-templates.html" + :href "https://penpot.app/libraries-templates" :target "_blank" :on-click on-click :on-key-down on-key-down} diff --git a/frontend/src/app/main/ui/releases/v1_9.cljs b/frontend/src/app/main/ui/releases/v1_9.cljs index e5dda41cc..6a8ddfba8 100644 --- a/frontend/src/app/main/ui/releases/v1_9.cljs +++ b/frontend/src/app/main/ui/releases/v1_9.cljs @@ -99,7 +99,7 @@ [:h2 "Libraries & templates"]] [:div.modal-content [:p "We’ve created a new space on Penpot where you can share your libraries and templates and download the ones you like. Material Design, Cocomaterial or Penpot’s Design System are among them (and a lot more to come!)."] - [:p [:a {:alt "Explore libraries & templates" :target "_blank" :href "https://penpot.app/libraries-templates.html"} "Explore libraries & templates"]]] + [:p [:a {:alt "Explore libraries & templates" :target "_blank" :href "https://penpot.app/libraries-templates"} "Explore libraries & templates"]]] [:div.modal-navigation [:button.btn-secondary {:on-click finish} "Start!"] [:& c/navigation-bullets From 17fb5283cc953eebe9e25ab8041855934b148b61 Mon Sep 17 00:00:00 2001 From: AzazelN28 Date: Mon, 22 Apr 2024 12:11:07 +0200 Subject: [PATCH 5/9] :paperclip: Add provider to validate uri --- backend/src/app/auth/oidc.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/app/auth/oidc.clj b/backend/src/app/auth/oidc.clj index 34e2cee57..efdf568e2 100644 --- a/backend/src/app/auth/oidc.clj +++ b/backend/src/app/auth/oidc.clj @@ -540,6 +540,7 @@ token (tokens/generate (::setup/props cfg) info) params (d/without-nils {:token token + :provider (:provider (:path-params request)) :fullname (:fullname info)}) uri (-> (u/uri (cf/get :public-uri)) (assoc :path "/#/auth/register/validate") From b667f1bb2c883cad6653d2cf73ce6f62f6bd38c4 Mon Sep 17 00:00:00 2001 From: Jordi Sala Morales Date: Mon, 22 Apr 2024 08:23:45 +0000 Subject: [PATCH 6/9] :bug: Fix adding pages with customized options --- frontend/src/app/libs/file_builder.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/libs/file_builder.cljs b/frontend/src/app/libs/file_builder.cljs index 0f0c3d069..4b09f795e 100644 --- a/frontend/src/app/libs/file_builder.cljs +++ b/frontend/src/app/libs/file_builder.cljs @@ -144,7 +144,7 @@ (str (:current-page-id file))) (addPage [_ name options] - (set! file (fb/add-page file {:name name :options options})) + (set! file (fb/add-page file {:name name :options (parse-data options)})) (str (:current-page-id file))) (closePage [_] From 0cb2e6d07dc09b5728fb81a030b3b837c5f79d2c Mon Sep 17 00:00:00 2001 From: Jordi Sala Morales Date: Tue, 23 Apr 2024 07:40:16 +0000 Subject: [PATCH 7/9] :bug: Fix default features for files exported with penpot lib Avoid having false as features, since it should be an array. --- frontend/src/app/libs/file_builder.cljs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/libs/file_builder.cljs b/frontend/src/app/libs/file_builder.cljs index 4b09f795e..ea046e255 100644 --- a/frontend/src/app/libs/file_builder.cljs +++ b/frontend/src/app/libs/file_builder.cljs @@ -7,6 +7,7 @@ (ns app.libs.file-builder (:require [app.common.data :as d] + [app.common.features :as cfeat] [app.common.files.builder :as fb] [app.common.media :as cm] [app.common.types.components-list :as ctkl] @@ -73,7 +74,7 @@ manifest-stream (->> files-stream - (rx/map #(e/create-manifest (uuid/next) (:id file) :all % false)) + (rx/map #(e/create-manifest (uuid/next) (:id file) :all % cfeat/default-features)) (rx/map (fn [a] (vector "manifest.json" a)))) From 7c80c605d1dc27134c9dd7df3765f36691bc8ee6 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Tue, 23 Apr 2024 11:25:18 +0200 Subject: [PATCH 8/9] :bug: Fix background color on scrollbar for firefox --- frontend/resources/styles/common/refactor/basic-rules.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/resources/styles/common/refactor/basic-rules.scss b/frontend/resources/styles/common/refactor/basic-rules.scss index f057974d0..c6141e431 100644 --- a/frontend/resources/styles/common/refactor/basic-rules.scss +++ b/frontend/resources/styles/common/refactor/basic-rules.scss @@ -6,6 +6,10 @@ // SCROLLBAR .new-scrollbar { + scrollbar-color: rgba(170, 181, 186, 0.3) transparent; + &:hover { + scrollbar-color: rgba(170, 181, 186, 0.7) transparent; + } ::-webkit-scrollbar { background-color: transparent; cursor: pointer; From 3c842d2b810371d69a4e3a8a710167c491d199e7 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 24 Apr 2024 13:17:57 +0200 Subject: [PATCH 9/9] :sparkles: Add exception page audit log event --- frontend/src/app/main/ui.cljs | 2 +- frontend/src/app/main/ui/static.cljs | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/main/ui.cljs b/frontend/src/app/main/ui.cljs index 9c7e3110c..7b2fb0296 100644 --- a/frontend/src/app/main/ui.cljs +++ b/frontend/src/app/main/ui.cljs @@ -170,7 +170,7 @@ [:& (mf/provider ctx/current-route) {:value route} [:& (mf/provider ctx/current-profile) {:value profile} (if edata - [:& static/exception-page {:data edata}] + [:& static/exception-page {:data edata :route route}] [:* [:& msgs/notifications-hub] (when route diff --git a/frontend/src/app/main/ui/static.cljs b/frontend/src/app/main/ui/static.cljs index 54b02f50b..5a0b0a11a 100644 --- a/frontend/src/app/main/ui/static.cljs +++ b/frontend/src/app/main/ui/static.cljs @@ -9,6 +9,8 @@ (:require [app.common.data :as d] [app.common.pprint :as pp] + [app.common.uri :as u] + [app.main.data.events :as ev] [app.main.store :as st] [app.main.ui.icons :as i] [app.util.dom :as dom] @@ -16,6 +18,7 @@ [app.util.i18n :refer [tr]] [app.util.router :as rt] [app.util.webapi :as wapi] + [potok.v2.core :as ptk] [rumext.v2 :as mf])) (mf/defc error-container @@ -146,15 +149,19 @@ (mf/defc exception-page {::mf/props :obj} - [{:keys [data] :as props}] - (case (:type data) - :not-found - [:& not-found] + [{:keys [data route] :as props}] + (let [type (:type data) + path (:path route) + query-params (u/map->query-string (:query-params route))] + (st/emit! (ptk/event ::ev/event {::ev/name "exception-page" :type type :path path :query-params query-params})) + (case (:type data) + :not-found + [:& not-found] - :bad-gateway - [:& bad-gateway] + :bad-gateway + [:& bad-gateway] - :service-unavailable - [:& service-unavailable] + :service-unavailable + [:& service-unavailable] - [:> internal-error props])) + [:> internal-error props])))