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

🎉 Add many functions to assets panel and big refactor

This commit is contained in:
Andrés Moya 2021-05-12 14:00:30 +02:00
parent 3c7dda02c6
commit b2fef7b7a8
9 changed files with 906 additions and 446 deletions

View file

@ -5,6 +5,11 @@
### :sparkles: New features
- Allow nested asset groups [Taiga #1716](https://tree.taiga.io/project/penpot/us/1716)
- Allow to ungroup assets [Taiga #1719](https://tree.taiga.io/project/penpot/us/1719)
- Allow to rename assets groups [Taiga #1721](https://tree.taiga.io/project/penpot/us/1721)
- Memorize collapse state of assets in panel [Taiga #1718](https://tree.taiga.io/project/penpot/us/1718)
### :bug: Bugs fixed
### :arrow_up: Deps updates
### :boom: Breaking changes

View file

@ -479,8 +479,7 @@
:var [2 nil]}
:d [nil 10] }
If both maps are identical the result will be an empty map
"
If both maps are identical the result will be an empty map."
[m1 m2]
(let [m1ks (set (keys m1))

View file

@ -60,6 +60,8 @@
(d/export helpers/get-base-shape)
(d/export helpers/is-parent?)
(d/export helpers/get-index-in-parent)
(d/export helpers/split-path)
(d/export helpers/join-path)
(d/export helpers/parse-path-name)
(d/export helpers/merge-path-item)
(d/export helpers/compact-path)

View file

@ -408,11 +408,17 @@
(defn split-path
"Decompose a string in the form 'one / two / three' into
an array of strings, normalizing spaces."
a vector of strings, normalizing spaces."
[path]
(->> (str/split path "/")
(map str/trim)
(remove str/empty?)))
(remove str/empty?)
vec))
(defn join-path
"Regenerate a path as a string, from a vector."
[path-vec]
(str/join " / " path-vec))
(defn parse-path-name
"Parse a string in the form 'group / subgroup / name'.
@ -427,7 +433,9 @@
"Put the item at the end of the path."
[path name]
(if-not (empty? path)
(str path " / " name)
(if-not (empty? name)
(str path " / " name)
path)
name))
(defn compact-path

View file

@ -71,6 +71,13 @@
(update [_ state]
(assoc-in state [:workspace-local :assets-files-open file-id box] open?))))
(defn set-assets-group-open
[file-id box path open?]
(ptk/reify ::set-assets-group-open
ptk/UpdateEvent
(update [_ state]
(assoc-in state [:workspace-local :assets-files-open file-id :groups box path] open?))))
(defn default-color-name [color]
(or (:color color)
(case (get-in color [:gradient :type])

View file

@ -105,7 +105,9 @@
{:class (dom/classnames :is-selected (and selected (= option-name selected)))
:key option-name}
(if-not sub-options
[:a.context-menu-action {:on-click option-handler}
[:a.context-menu-action {:on-click #(do (dom/stop-propagation %)
(on-close)
(option-handler %))}
option-name]
[:a.context-menu-action.submenu
{:data-no-close true

File diff suppressed because it is too large Load diff

View file

@ -1591,6 +1591,10 @@ msgstr "No assets found"
msgid "workspace.assets.rename"
msgstr "Rename"
#: src/app/main/ui/workspace/sidebar/assets.cljs
msgid "workspace.assets.rename-group"
msgstr "Rename group"
#: src/app/main/ui/workspace/sidebar/assets.cljs
msgid "workspace.assets.search"
msgstr "Search assets"
@ -1641,6 +1645,10 @@ msgstr "Ag"
msgid "workspace.assets.typography.text-transform"
msgstr "Text Transform"
#: src/app/main/ui/workspace/sidebar/assets.cljs
msgid "workspace.assets.ungroup"
msgstr "Ungroup"
#: src/app/main/data/workspace/libraries.cljs, src/app/main/ui/components/color_bullet.cljs
msgid "workspace.gradients.linear"
msgstr "Linear gradient"

View file

@ -1583,6 +1583,10 @@ msgstr "No se encontraron recursos"
msgid "workspace.assets.rename"
msgstr "Renombrar"
#: src/app/main/ui/workspace/sidebar/assets.cljs
msgid "workspace.assets.rename-group"
msgstr "Renombrar grupo"
#: src/app/main/ui/workspace/sidebar/assets.cljs
msgid "workspace.assets.search"
msgstr "Buscar recursos"
@ -1633,6 +1637,10 @@ msgstr "Ag"
msgid "workspace.assets.typography.text-transform"
msgstr "Transformar texto"
#: src/app/main/ui/workspace/sidebar/assets.cljs
msgid "workspace.assets.ungroup"
msgstr "Desagrupar"
#: src/app/main/data/workspace/libraries.cljs, src/app/main/ui/components/color_bullet.cljs
msgid "workspace.gradients.linear"
msgstr "Degradado lineal"