0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 07:50:43 -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 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

View file

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

View file

@ -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)

View file

@ -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;

View file

@ -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))))
@ -144,7 +145,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 [_]

View file

@ -485,6 +485,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))
@ -507,7 +508,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
@ -580,8 +583,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)))))))

View file

@ -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

View file

@ -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}

View file

@ -99,7 +99,7 @@
[:h2 "Libraries & templates"]]
[: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 [: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

View file

@ -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])))

View file

@ -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)}