0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-22 14:57:01 -05:00

Merge pull request #5525 from penpot/palba-testabc-add-library

A/B/C test for rename and change look and feel of "libraries" button
This commit is contained in:
Andrey Antukh 2025-01-09 08:34:05 +01:00 committed by GitHub
commit 1cbeafe85c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -89,8 +89,11 @@
reverse-sort? (= :desc ordering) reverse-sort? (= :desc ordering)
num-libs (count (mf/deref refs/workspace-libraries)) num-libs (count (mf/deref refs/workspace-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
@ -160,11 +163,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"}
@ -172,7 +182,7 @@
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
@ -197,7 +207,7 @@
[:> 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}