0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-30 16:41:20 -05:00

Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Andrey Antukh 2025-01-09 17:37:33 +01:00
commit a1037fb053
5 changed files with 65 additions and 54 deletions

View file

@ -15,6 +15,11 @@
### :bug: Bugs fixed ### :bug: Bugs fixed
## 2.4.1
### :bug: Bugs fixed
- Fix error when importing files with touched components [Taiga #9625](https://tree.taiga.io/project/penpot/issue/9625)
## 2.4.0 ## 2.4.0

View file

@ -6,4 +6,4 @@
(ns app.common.files.defaults) (ns app.common.files.defaults)
(def version 58) (def version 60)

View file

@ -1130,7 +1130,22 @@
(update :pages-index dissoc nil) (update :pages-index dissoc nil)
(update :pages-index update-vals update-page)))) (update :pages-index update-vals update-page))))
(defn migrate-up-58 (defn migrate-up-59
[data]
(letfn [(fix-touched [elem]
(cond-> elem (string? elem) keyword))
(update-shape [shape]
(d/update-when shape :touched #(into #{} (map fix-touched) %)))
(update-container [container]
(d/update-when container :objects update-vals update-shape))]
(-> data
(update :pages-index update-vals update-container)
(update :components update-vals update-container))))
(defn migrate-up-60
[data] [data]
(letfn [(update-object [object] (letfn [(update-object [object]
(if (and (:rx object) (not (:r1 object))) (if (and (:rx object) (not (:r1 object)))
@ -1148,27 +1163,6 @@
(update :pages-index update-vals update-container) (update :pages-index update-vals update-container)
(update :components update-vals update-container)))) (update :components update-vals update-container))))
(defn migrate-down-58
[data]
(letfn [(update-object [object]
(if (= (:r1 object) (:r2 object) (:r3 object) (:r4 object))
(-> object
(dissoc :r1 :r2 :r3 :r4)
(assoc :rx (:r1 object))
(assoc :ry (:r1 object)))
object))
(update-container [container]
(d/update-when container :objects update-vals update-object))]
(-> data
(update :pages-index update-vals update-container)
(update :components update-vals update-container))))
(def migrations (def migrations
"A vector of all applicable migrations" "A vector of all applicable migrations"
[{:id 2 :migrate-up migrate-up-2} [{:id 2 :migrate-up migrate-up-2}
@ -1218,5 +1212,6 @@
{:id 55 :migrate-up migrate-up-55} {:id 55 :migrate-up migrate-up-55}
{:id 56 :migrate-up migrate-up-56} {:id 56 :migrate-up migrate-up-56}
{:id 57 :migrate-up migrate-up-57} {:id 57 :migrate-up migrate-up-57}
{:id 58 :migrate-up migrate-up-58 :migrate-down migrate-down-58}]) {:id 59 :migrate-up migrate-up-59}
{:id 60 :migrate-up migrate-up-60}])

View file

@ -213,7 +213,8 @@
[:grow-type {:optional true} [:grow-type {:optional true}
[::sm/one-of grow-types]] [::sm/one-of grow-types]]
[:applied-tokens {:optional true} ::cto/applied-tokens] [:applied-tokens {:optional true} ::cto/applied-tokens]
[:plugin-data {:optional true} ::ctpg/plugin-data]]) [:plugin-data {:optional true} ::ctpg/plugin-data]
[:touched {:optional true} [:maybe [:set :keyword]]]])
(def schema:group-attrs (def schema:group-attrs
[:map {:title "GroupAttrs"} [:map {:title "GroupAttrs"}

View file

@ -90,8 +90,11 @@
reverse-sort? (= :desc ordering) reverse-sort? (= :desc ordering)
num-libs (count (mf/deref refs/libraries)) num-libs (count (mf/deref refs/libraries))
show-templates-02-test? show-templates-04-test1?
(and (cf/external-feature-flag "templates-02" "test") (zero? num-libs)) (and (cf/external-feature-flag "templates-04" "test1") (zero? num-libs))
show-templates-04-test2?
(and (cf/external-feature-flag "templates-04" "test2") (zero? num-libs))
toggle-ordering toggle-ordering
(mf/use-fn (mf/use-fn
@ -161,11 +164,18 @@
[:article {:class (stl/css :assets-bar)} [:article {:class (stl/css :assets-bar)}
[:div {:class (stl/css :assets-header)} [:div {:class (stl/css :assets-header)}
(when-not ^boolean read-only? (when-not ^boolean read-only?
(if show-templates-02-test? (cond
show-templates-04-test1?
[:button {:class (stl/css :libraries-button)
:on-click show-libraries-dialog
:data-testid "libraries"}
(tr "workspace.assets.add-library")]
show-templates-04-test2?
[:button {:class (stl/css :add-library-button) [:button {:class (stl/css :add-library-button)
:on-click show-libraries-dialog :on-click show-libraries-dialog
:data-testid "libraries"} :data-testid "libraries"}
(tr "workspace.assets.add-library")] (tr "workspace.assets.add-library")]
:else
[:button {:class (stl/css :libraries-button) [:button {:class (stl/css :libraries-button)
:on-click show-libraries-dialog :on-click show-libraries-dialog
:data-testid "libraries"} :data-testid "libraries"}
@ -173,32 +183,32 @@
i/library] i/library]
(tr "workspace.assets.libraries")])) (tr "workspace.assets.libraries")]))
(when-not show-templates-02-test?
[:div {:class (stl/css :search-wrapper)} [:div {:class (stl/css :search-wrapper)}
[:& search-bar {:on-change on-search-term-change [:& search-bar {:on-change on-search-term-change
:value term :value term
:placeholder (tr "workspace.assets.search")} :placeholder (tr "workspace.assets.search")}
[:button [:button
{:on-click on-open-menu {:on-click on-open-menu
:title (tr "workspace.assets.filter") :title (tr "workspace.assets.filter")
:class (stl/css-case :section-button true :class (stl/css-case :section-button true
:opened menu-open?)} :opened menu-open?)}
i/filter-icon]] i/filter-icon]]
[:> context-menu* [:> context-menu*
{:on-close on-menu-close {:on-close on-menu-close
:selectable true :selectable true
:selected section :selected section
:show menu-open? :show menu-open?
:fixed true :fixed true
:min-width true :min-width true
:width size :width size
:top 158 :top 158
:left 18 :left 18
:options options}] :options options}]
[:> icon-button* {:variant "ghost" [:> icon-button* {:variant "ghost"
:aria-label (tr "workspace.assets.sort") :aria-label (tr "workspace.assets.sort")
:on-click toggle-ordering :on-click toggle-ordering
:icon (if reverse-sort? "asc-sort" "desc-sort")}]])] :icon (if reverse-sort? "asc-sort" "desc-sort")}]]]
[:& (mf/provider cmm/assets-filters) {:value filters} [:& (mf/provider cmm/assets-filters) {:value filters}
[:& (mf/provider cmm/assets-toggle-ordering) {:value toggle-ordering} [:& (mf/provider cmm/assets-toggle-ordering) {:value toggle-ordering}