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

This commit is contained in:
Andrey Antukh 2024-11-25 11:50:19 +01:00
commit 5ee0399615
24 changed files with 118 additions and 418 deletions

View file

@ -450,7 +450,9 @@
(ptk/reify ::update-team
ptk/UpdateEvent
(update [_ state]
(assoc-in state [:teams id :name] name))
(-> state
(assoc-in [:teams id :name] name)
(assoc-in [:team :name] name)))
ptk/WatchEvent
(watch [_ _ _]

View file

@ -338,7 +338,7 @@
;; used to render thumbnails on assets panel.
(mf/defc component-svg
{::mf/wrap [mf/memo #(mf/deferred % ts/idle-then-raf)]}
[{:keys [objects root-shape show-grids? zoom class] :or {zoom 1} :as props}]
[{:keys [objects root-shape show-grids? is-hidden zoom class] :or {zoom 1} :as props}]
(when root-shape
(let [root-shape-id (:id root-shape)
include-metadata (mf/use-ctx export/include-metadata-ctx)
@ -381,13 +381,14 @@
:xmlns:penpot (when include-metadata "https://penpot.app/xmlns")
:fill "none"}
[:*
[:> shape-container {:shape root-shape'}
[:& (mf/provider muc/is-component?) {:value true}
[:& root-shape-wrapper {:shape root-shape' :view-box vbox}]]]
(when-not is-hidden
[:*
[:> shape-container {:shape root-shape'}
[:& (mf/provider muc/is-component?) {:value true}
[:& root-shape-wrapper {:shape root-shape' :view-box vbox}]]]
(when show-grids?
[:& empty-grids {:root-shape-id root-shape-id :objects objects}])]])))
(when show-grids?
[:& empty-grids {:root-shape-id root-shape-id :objects objects}])])])))
(mf/defc component-svg-thumbnail
{::mf/wrap [mf/memo #(mf/deferred % ts/idle-then-raf)]}

View file

@ -9,6 +9,7 @@
[app.common.types.component :as ctk]
[app.common.types.shape :as cts]
[app.common.types.shape.layout :as ctl]
[app.config :as cf]
[app.main.ui.icons :as i]
[rumext.v2 :as mf]))
@ -31,7 +32,7 @@
i/flex-grid
:else
i/board)
(if (cf/external-feature-flag "boards-01" "test") i/board-2 i/board))
;; TODO -> THUMBNAIL ICON
:image i/img
:line (if (cts/has-images? shape) i/img i/path)
@ -56,7 +57,7 @@
(if main-instance?
i/component
(case type
:frame i/board
:frame (if (cf/external-feature-flag "boards-01" "test") i/board-2 i/board)
:image i/img
:shape i/path
:text i/text

View file

@ -73,7 +73,9 @@
{::mf/register modal/components
::mf/register-as :team-form}
[{:keys [team] :as props}]
(let [initial (mf/use-memo (fn [] (or team {})))
(let [initial (mf/use-memo (fn []
(or (some-> team (select-keys [:name :id]))
{})))
form (fm/use-form :schema schema:team-form
:initial initial)
handle-keydown

View file

@ -63,6 +63,7 @@
(def ^:icon arrow (icon-xref :arrow))
(def ^:icon asc-sort (icon-xref :asc-sort))
(def ^:icon board (icon-xref :board))
(def ^:icon board-2 (icon-xref :board-2))
(def ^:icon boards-thumbnail (icon-xref :boards-thumbnail))
(def ^:icon boolean-difference (icon-xref :boolean-difference))
(def ^:icon boolean-exclude (icon-xref :boolean-exclude))

View file

@ -41,7 +41,7 @@
"The introduction of our brand new Plugin system allows you to access even richer ecosystem of capabilities."]
[:p {:class (stl/css :feature-content)}
"We are beyond excitement about how this will further involve the Penpot community in building the best design and prototyping platform."]
"We are beyond excited about how this will further involve the Penpot community in building the best design and prototyping platform."]
[:p {:class (stl/css :feature-content)}
"Lets dive in!"]]
@ -69,7 +69,7 @@
"Penpot Plugins encourage developers to easily customize and expand the platform using standard web technologies like JavaScript, CSS, and HTML."]
[:p {:class (stl/css :feature-content)}
"Find everything you need in ouor full comprehensive documentation to start building your plugins now!"]]
"Find everything you need in our full comprehensive documentation to start building your plugins now!"]]
[:div {:class (stl/css :navigation)}
[:& c/navigation-bullets
@ -101,7 +101,7 @@
"Be sure to keep an eye on our evolving " [:a {:href "https://penpot.app/penpothub" :target "_blank"} "Penpot Hub"] " to pick the ones that are best suited to enhance your workflow."]
[:p {:class (stl/css :feature-content)}
"This is just the beginning of a myriad of possibilities. Lets build this community together <3."]]
"This is just the beginning of a myriad of possibilities. Lets build this community together ❤️."]]
[:div {:class (stl/css :navigation)}

View file

@ -24,6 +24,7 @@
[app.main.data.workspace.libraries :as dwl]
[app.main.data.workspace.shortcuts :as sc]
[app.main.data.workspace.undo :as dwu]
[app.main.data.workspace.versions :as dwv]
[app.main.features :as features]
[app.main.refs :as refs]
[app.main.store :as st]
@ -537,6 +538,19 @@
(when (kbd/enter? event)
(on-show-version-history event))))
on-pin-version
(mf/use-fn
(mf/deps file-id)
(fn [_]
(st/emit! (dwv/create-version file-id))))
on-pin-version-key-down
(mf/use-fn
(mf/deps on-pin-version)
(fn [event]
(when (kbd/enter? event)
(on-pin-version event))))
on-export-shapes
(mf/use-fn #(st/emit! (de/show-workspace-export-dialog {:origin "workspace:menu"})))
@ -599,6 +613,15 @@
[:span {:class (stl/css :item-name)}
(tr "dashboard.add-shared")]]))
[:div {:class (stl/css :separator)}]
[:> dropdown-menu-item* {:class (stl/css :submenu-item)
:on-click on-pin-version
:on-key-down on-pin-version-key-down
:id "file-menu-show-version-history"}
[:span {:class (stl/css :item-name)}
(tr "dashboard.create-version-menu")]]
[:> dropdown-menu-item* {:class (stl/css :submenu-item)
:on-click on-show-version-history
:on-key-down on-show-version-history-key-down
@ -606,6 +629,8 @@
[:span {:class (stl/css :item-name)}
(tr "dashboard.show-version-history")]]
[:div {:class (stl/css :separator)}]
[:> dropdown-menu-item* {:class (stl/css :submenu-item)
:on-click on-export-shapes
:on-key-down on-export-shapes-key-down

View file

@ -43,9 +43,12 @@
}
.separator {
margin-top: $s-8;
border-top: $s-1 solid var(--color-background-quaternary);
height: $s-4;
border-top: $s-1 solid var(--color-background-secondary);
left: calc(-1 * $s-4);
margin-top: $s-8;
position: relative;
width: calc(100% + $s-8);
}
.shortcut {

View file

@ -237,15 +237,11 @@
[:& comments-sidebar]
(true? is-history?)
[:> tab-switcher* {:tabs #js [#js {:label "History" :id "history" :content versions-tab}
#js {:label "Actions" :id "actions" :content history-tab}]
:default-selected "history"
;;:selected (name section)
;;:on-change-tab on-tab-change
:class (stl/css :left-sidebar-tabs)
;;:action-button-position "start"
;;:action-button (mf/html [:& collapse-button {:on-click handle-collapse}])
}]
[:> tab-switcher*
{:tabs #js [#js {:label (tr "workspace.versions.tab.history") :id "history" :content versions-tab}
#js {:label (tr "workspace.versions.tab.actions") :id "actions" :content history-tab}]
:default-selected "history"
:class (stl/css :left-sidebar-tabs)}]
:else
[:> options-toolbox props])]]]))

View file

@ -113,4 +113,5 @@ $width-settings-bar-max: $s-500;
.versions-tab {
width: 100%;
overflow: hidden;
height: calc(100vh - $s-88);
}

View file

@ -133,23 +133,23 @@
options
[{:name (tr "workspace.assets.box-filter-all")
:id "section-all"
:id "all"
:handler on-section-filter-change}
{:name (tr "workspace.assets.components")
:id "section-components"
:id "components"
:handler on-section-filter-change}
(when (not components-v2)
{:name (tr "workspace.assets.graphics")
:id "section-graphics"
:id "graphics"
:handler on-section-filter-change})
{:name (tr "workspace.assets.colors")
:id "section-colors"
:id "colors"
:handler on-section-filter-change}
{:name (tr "workspace.assets.typography")
:id "section-typographies"
:id "typographies"
:handler on-section-filter-change}]]
[:article {:class (stl/css :assets-bar)}

View file

@ -270,7 +270,7 @@
(mf/defc component-item-thumbnail
"Component that renders the thumbnail image or the original SVG."
{::mf/props :obj}
[{:keys [file-id root-shape component container class]}]
[{:keys [file-id root-shape component container class is-hidden]}]
(let [page-id (:main-instance-page component)
root-id (:main-instance-id component)
retry (mf/use-state 0)
@ -290,7 +290,8 @@
(when (< @retry 3)
(inc retry))))]
(if (and (some? thumbnail-uri) (contains? cf/flags :component-thumbnails))
(if (and (some? thumbnail-uri)
(contains? cf/flags :component-thumbnails))
[:& component-svg-thumbnail
{:thumbnail-uri thumbnail-uri
:class class
@ -303,7 +304,8 @@
{:root-shape root-shape
:class class
:objects (:objects container)
:show-grids? true}])))
:show-grids? true
:is-hidden is-hidden}])))
(defn generate-components-menu-entries
[shapes components-v2]

View file

@ -171,13 +171,13 @@
(when ^boolean dragging?
[:div {:class (stl/css :dragging)}])]
(when visible?
[:& cmm/component-item-thumbnail {:file-id file-id
:class (stl/css-case :thumbnail true
:asset-list-thumbnail (not listing-thumbs?))
:root-shape root-shape
:component component
:container container}])])]))
[:& cmm/component-item-thumbnail {:file-id file-id
:class (stl/css-case :thumbnail true
:asset-list-thumbnail (not listing-thumbs?))
:root-shape root-shape
:component component
:container container
:is-hidden (not visible?)}]])]))
(mf/defc components-group
{::mf/wrap-props false}

View file

@ -74,14 +74,13 @@
(mf/defc file-library-content
{::mf/wrap-props false}
[{:keys [file local? open-status-ref on-clear-selection]}]
[{:keys [file local? open-status-ref on-clear-selection filters]}]
(let [components-v2 (mf/use-ctx ctx/components-v2)
open-status (mf/deref open-status-ref)
file-id (:id file)
project-id (:project-id file)
filters (mf/use-ctx cmm/assets-filters)
filters-section (:section filters)
filters-term (:term filters)

View file

@ -9,6 +9,7 @@
(:require
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.config :as cf]
[app.main.data.workspace.undo :as dwu]
[app.main.refs :as refs]
[app.main.store :as st]
@ -154,7 +155,7 @@
:circle i/elipse
:text i/text
:path i/path
:frame i/board
:frame (if (cf/external-feature-flag "boards-01" "test") i/board-2 i/board)
:group i/group
:color i/drop-icon
:typography i/text-palette

View file

@ -12,6 +12,7 @@
[app.common.files.helpers :as cfh]
[app.common.types.shape :as cts]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.main.data.workspace :as dw]
[app.main.refs :as refs]
[app.main.store :as st]
@ -335,7 +336,7 @@
:on-click add-filter}
[:div {:class (stl/css :filter-menu-item-name-wrapper)}
[:span {:class (stl/css :filter-menu-item-icon)}
i/board]
(if (cf/external-feature-flag "boards-01" "test") i/board-2 i/board)]
[:span {:class (stl/css :filter-menu-item-name)}
(tr "workspace.sidebar.layers.frames")]]

View file

@ -8,6 +8,10 @@
.version-toolbox {
padding: $s-8;
height: 100%;
display: grid;
overflow: hidden;
grid-template-rows: auto auto 1fr;
}
.versions-entry-empty {
@ -49,6 +53,8 @@
display: flex;
flex-direction: column;
gap: $s-6;
overflow: auto;
margin: 0;
}
.version-entry {

View file

@ -10,6 +10,7 @@
[app.common.data.macros :as dm]
[app.common.geom.point :as gpt]
[app.common.media :as cm]
[app.config :as cf]
[app.main.data.events :as ev]
[app.main.data.modal :as modal]
[app.main.data.workspace :as dw]
@ -146,7 +147,7 @@
:on-click select-drawtool
:data-tool "frame"
:data-testid "artboard-btn"}
i/board]]
(if (cf/external-feature-flag "boards-01" "test") i/board-2 i/board)]]
[:li
[:button
{:title (tr "workspace.toolbar.rect" (sc/get-tooltip :draw-rect))

View file

@ -148,9 +148,7 @@
(mf/set-ref-val! internal-state initial))
(mf/with-effect [initial]
(if (fn? initial)
(swap! form-mutator update :data merge (initial))
(swap! form-mutator update :data merge initial)))
(swap! form-mutator d/deep-merge initial))
form-mutator))