0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -05:00

Merge branch 'staging' into develop

This commit is contained in:
AzazelN28 2024-04-25 11:32:28 +02:00
commit 47804429c0
11 changed files with 68 additions and 28 deletions

View file

@ -7,6 +7,9 @@
- Fix locking contention on cron subsystem (causes backend start blocking) - Fix locking contention on cron subsystem (causes backend start blocking)
- Fix locking contention on file object thumbails backend RPC calls - 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 ## 2.0.1

View file

@ -497,12 +497,13 @@
(redirect-response uri)))) (redirect-response uri))))
(defn- redirect-to-register (defn- redirect-to-register
[cfg info] [cfg info request]
(let [info (assoc info (let [info (assoc info
:iss :prepared-register :iss :prepared-register
:exp (dt/in-future {:hours 48})) :exp (dt/in-future {:hours 48}))
params {:token (tokens/generate (::setup/props cfg) info) params {:token (tokens/generate (::setup/props cfg) info)
:provider (:provider (:path-params request))
:fullname (:fullname info)} :fullname (:fullname info)}
params (d/without-nils params)] params (d/without-nils params)]
@ -549,7 +550,7 @@
(not (:is-active profile)) (not (:is-active profile))
(let [info (assoc info :profile-id (:id profile))] (let [info (assoc info :profile-id (:id profile))]
(redirect-to-register cfg info)) (redirect-to-register cfg info request))
:else :else
(let [sxf (session/create-fn cfg (:id profile)) (let [sxf (session/create-fn cfg (:id profile))
@ -575,7 +576,7 @@
:else :else
(let [info (assoc info :is-active (provider-has-email-verified? cfg info))] (let [info (assoc info :is-active (provider-has-email-verified? cfg info))]
(if (contains? cf/flags :registration) (if (contains? cf/flags :registration)
(redirect-to-register cfg info) (redirect-to-register cfg info request)
(redirect-with-error "registration-disabled"))))) (redirect-with-error "registration-disabled")))))
(defn- auth-handler (defn- auth-handler

View file

@ -386,7 +386,8 @@
(fn [new-shape original-shape] (fn [new-shape original-shape]
(let [new-name (:name new-shape) (let [new-name (:name new-shape)
root? (or (ctk/instance-root? original-shape) ; If shape is inside a component (not components-v2) 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? (when root?
(vswap! unames conj new-name)) (vswap! unames conj new-name))
@ -398,6 +399,9 @@
(-> (gsh/move delta) (-> (gsh/move delta)
(dissoc :touched)) (dissoc :touched))
(some? swap-slot)
(assoc :touched #{(ctk/build-swap-slot-group swap-slot)})
(and main-instance? root?) (and main-instance? root?)
(assoc :main-instance true) (assoc :main-instance true)

View file

@ -6,6 +6,10 @@
// SCROLLBAR // SCROLLBAR
.new-scrollbar { .new-scrollbar {
scrollbar-color: rgba(170, 181, 186, 0.3) transparent;
&:hover {
scrollbar-color: rgba(170, 181, 186, 0.7) transparent;
}
::-webkit-scrollbar { ::-webkit-scrollbar {
background-color: transparent; background-color: transparent;
cursor: pointer; cursor: pointer;

View file

@ -7,6 +7,7 @@
(ns app.libs.file-builder (ns app.libs.file-builder
(:require (:require
[app.common.data :as d] [app.common.data :as d]
[app.common.features :as cfeat]
[app.common.files.builder :as fb] [app.common.files.builder :as fb]
[app.common.media :as cm] [app.common.media :as cm]
[app.common.types.components-list :as ctkl] [app.common.types.components-list :as ctkl]
@ -73,7 +74,7 @@
manifest-stream manifest-stream
(->> files-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] (rx/map (fn [a]
(vector "manifest.json" a)))) (vector "manifest.json" a))))
@ -144,7 +145,7 @@
(str (:current-page-id file))) (str (:current-page-id file)))
(addPage [_ name options] (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))) (str (:current-page-id file)))
(closePage [_] (closePage [_]

View file

@ -485,6 +485,7 @@
duplicating-component? (or duplicating-component? (ctk/instance-head? obj)) duplicating-component? (or duplicating-component? (ctk/instance-head? obj))
is-component-main? (ctk/main-instance? obj) is-component-main? (ctk/main-instance? obj)
subinstance-head? (ctk/subinstance-head? obj) subinstance-head? (ctk/subinstance-head? obj)
instance-root? (ctk/instance-root? obj)
into-component? (and duplicating-component? into-component? (and duplicating-component?
(ctn/in-any-component? objects parent)) (ctn/in-any-component? objects parent))
@ -507,7 +508,9 @@
:parent-id parent-id :parent-id parent-id
:frame-id frame-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)) (ctk/remove-swap-slot))
(dissoc :shapes (dissoc :shapes
@ -580,8 +583,9 @@
true true
(and remove-swap-slot? (and remove-swap-slot?
;; only remove swap slot of children when the current shape ;; only remove swap slot of children when the current shape
;; is not a subinstance head ;; is not a subinstance head nor a instance root
(not subinstance-head?)))) (not subinstance-head?)
(not instance-root?))))
changes changes
(map (d/getf objects) (:shapes obj))))))) (map (d/getf objects) (:shapes obj)))))))

View file

@ -170,7 +170,7 @@
[:& (mf/provider ctx/current-route) {:value route} [:& (mf/provider ctx/current-route) {:value route}
[:& (mf/provider ctx/current-profile) {:value profile} [:& (mf/provider ctx/current-profile) {:value profile}
(if edata (if edata
[:& static/exception-page {:data edata}] [:& static/exception-page {:data edata :route route}]
[:* [:*
[:& msgs/notifications-hub] [:& msgs/notifications-hub]
(when route (when route

View file

@ -155,7 +155,7 @@
[:div {:class (stl/css :img-container)} [:div {:class (stl/css :img-container)}
[:a {:id id [:a {:id id
:tab-index (if (or (not is-visible) collapsed) "-1" "0") :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" :target "_blank"
:on-click on-click :on-click on-click
:on-key-down on-key-down} :on-key-down on-key-down}

View file

@ -99,7 +99,7 @@
[:h2 "Libraries & templates"]] [:h2 "Libraries & templates"]]
[:div.modal-content [:div.modal-content
[:p "Weve created a new space on Penpot where you can share your libraries and templates and download the ones you like. Material Design, Cocomaterial or Penpots Design System are among them (and a lot more to come!)."] [:p "Weve created a new space on Penpot where you can share your libraries and templates and download the ones you like. Material Design, Cocomaterial or Penpots 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 [:div.modal-navigation
[:button.btn-secondary {:on-click finish} "Start!"] [:button.btn-secondary {:on-click finish} "Start!"]
[:& c/navigation-bullets [:& c/navigation-bullets

View file

@ -9,6 +9,8 @@
(:require (:require
[app.common.data :as d] [app.common.data :as d]
[app.common.pprint :as pp] [app.common.pprint :as pp]
[app.common.uri :as u]
[app.main.data.events :as ev]
[app.main.store :as st] [app.main.store :as st]
[app.main.ui.icons :as i] [app.main.ui.icons :as i]
[app.util.dom :as dom] [app.util.dom :as dom]
@ -16,6 +18,7 @@
[app.util.i18n :refer [tr]] [app.util.i18n :refer [tr]]
[app.util.router :as rt] [app.util.router :as rt]
[app.util.webapi :as wapi] [app.util.webapi :as wapi]
[potok.v2.core :as ptk]
[rumext.v2 :as mf])) [rumext.v2 :as mf]))
(mf/defc error-container (mf/defc error-container
@ -146,7 +149,11 @@
(mf/defc exception-page (mf/defc exception-page
{::mf/props :obj} {::mf/props :obj}
[{:keys [data] :as props}] [{: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) (case (:type data)
:not-found :not-found
[:& not-found] [:& not-found]
@ -157,4 +164,4 @@
:service-unavailable :service-unavailable
[:& service-unavailable] [:& service-unavailable]
[:> internal-error props])) [:> internal-error props])))

View file

@ -7,6 +7,7 @@
(ns app.main.ui.workspace.colorpicker.libraries (ns app.main.ui.workspace.colorpicker.libraries
(:require-macros [app.main.style :as stl]) (:require-macros [app.main.style :as stl])
(:require (:require
[app.common.colors :as c]
[app.common.data :as d] [app.common.data :as d]
[app.common.data.macros :as dm] [app.common.data.macros :as dm]
[app.main.data.events :as ev] [app.main.data.events :as ev]
@ -43,10 +44,23 @@
(parse-uuid event))))) (parse-uuid event)))))
check-valid-color? check-valid-color?
(mf/use-fn
(fn [color] (fn [color]
(and (or (not disable-gradient) (not (:gradient color))) (and (or (not disable-gradient) (not (:gradient color)))
(or (not disable-opacity) (= 1 (:opacity color))) (or (not disable-opacity) (= 1 (:opacity color)))
(or (not disable-image) (not (:image 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 toggle-palette
(mf/use-fn (mf/use-fn
@ -89,13 +103,15 @@
(sort-by :name) (sort-by :name)
(map #(assoc % :file-id file-id)))))] (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 ;; If the file colors change and the file option is selected updates the state
(mf/with-effect [file-colors] (mf/with-effect [file-colors]
(when (= @selected :file) (when (= @selected :file)
(let [colors (vals file-colors)] (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 :libraries)}
[:div {:class (stl/css :select-wrapper)} [:div {:class (stl/css :select-wrapper)}