0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 15:39:50 -05:00

Add some small enhancements

This commit is contained in:
Andrés Moya 2022-08-29 09:50:04 +02:00
parent c1942ef408
commit 1675d945d9
2 changed files with 8 additions and 10 deletions

View file

@ -423,13 +423,11 @@
[{:keys [pool] :as cfg} {:keys [team-id] :as params}] [{:keys [pool] :as cfg} {:keys [team-id] :as params}]
(let [assets-sample (let [assets-sample
(fn [assets limit] (fn [assets limit]
(let [sorted-assets (->> assets (let [sorted-assets (->> (vals assets)
(vals)
(vec)
(sort-by #(str/lower (:name %))))] (sort-by #(str/lower (:name %))))]
{:count (count sorted-assets) {:count (count sorted-assets)
:sample (take limit sorted-assets)})) :sample (into [] (take limit sorted-assets))}))
library-summary library-summary
(fn [data] (fn [data]

View file

@ -78,14 +78,14 @@
typographies (:typographies summary)] typographies (:typographies summary)]
[:* [:*
(when (> (:count components) 0) (when (pos? (:count components))
[:div.asset-section [:div.asset-section
[:div.asset-title [:div.asset-title
[:span (tr "workspace.assets.components")] [:span (tr "workspace.assets.components")]
[:span.num-assets (str "\u00A0(") (:count components) ")"]] ;; Unicode 00A0 is non-breaking space [:span.num-assets (str "\u00A0(") (:count components) ")"]] ;; Unicode 00A0 is non-breaking space
[:div.asset-list [:div.asset-list
(for [component (:sample components)] (for [component (:sample components)]
[:div.asset-list-item [:div.asset-list-item {:key (str "assets-component-" (:id component))}
[:& component-svg {:group (get-in component [:objects (:id component)]) [:& component-svg {:group (get-in component [:objects (:id component)])
:objects (:objects component)}] :objects (:objects component)}]
[:div.name-block [:div.name-block
@ -96,7 +96,7 @@
[:div.name-block [:div.name-block
[:span.item-name "(...)"]]])]]) [:span.item-name "(...)"]]])]])
(when (> (:count colors) 0) (when (pos? (:count colors))
[:div.asset-section [:div.asset-section
[:div.asset-title [:div.asset-title
[:span (tr "workspace.assets.colors")] [:span (tr "workspace.assets.colors")]
@ -107,7 +107,7 @@
(:gradient color) (bc/gradient-type->string (get-in color [:gradient :type])) (:gradient color) (bc/gradient-type->string (get-in color [:gradient :type]))
(:color color) (:color color) (:color color) (:color color)
:else (:value color))] :else (:value color))]
[:div.asset-list-item [:div.asset-list-item {:key (str "assets-color-" (:id color))}
[:& bc/color-bullet {:color {:color (:color color) [:& bc/color-bullet {:color {:color (:color color)
:opacity (:opacity color)}}] :opacity (:opacity color)}}]
[:div.name-block [:div.name-block
@ -119,14 +119,14 @@
[:div.name-block [:div.name-block
[:span.item-name "(...)"]]])]]) [:span.item-name "(...)"]]])]])
(when (> (:count typographies) 0) (when (pos? (:count typographies))
[:div.asset-section [:div.asset-section
[:div.asset-title [:div.asset-title
[:span (tr "workspace.assets.typography")] [:span (tr "workspace.assets.typography")]
[:span.num-assets (str "\u00A0(") (:count typographies) ")"]] ;; Unicode 00A0 is non-breaking space [:span.num-assets (str "\u00A0(") (:count typographies) ")"]] ;; Unicode 00A0 is non-breaking space
[:div.asset-list [:div.asset-list
(for [typography (:sample typographies)] (for [typography (:sample typographies)]
[:div.asset-list-item [:div.asset-list-item {:key (str "assets-typography-" (:id typography))}
[:div.typography-sample [:div.typography-sample
{:style {:font-family (:font-family typography) {:style {:font-family (:font-family typography)
:font-weight (:font-weight typography) :font-weight (:font-weight typography)