mirror of
https://github.com/penpot/penpot.git
synced 2026-09-13 07:30:24 +00:00
🐛 Fix menu entry not showing on assets tab (#7115)
* 🐛 Fix menu entry not showing on assets tab * ✨ MR changes
This commit is contained in:
parent
2e277a39ca
commit
108d4fabba
@ -172,6 +172,19 @@
|
|||||||
[:span {:class (stl/css-case :variant-mark-cell listing-thumbs? :variant-mark true :component-icon true)
|
[:span {:class (stl/css-case :variant-mark-cell listing-thumbs? :variant-mark true :component-icon true)
|
||||||
:title (tr "workspace.assets.components.num-variants" num-variants)} i/variant])])]))
|
:title (tr "workspace.assets.components.num-variants" num-variants)} i/variant])])]))
|
||||||
|
|
||||||
|
|
||||||
|
(defn- count-leaves
|
||||||
|
"Counts the total number of leaf elements in a nested map structure.
|
||||||
|
A leaf element is considered any element inside a vector."
|
||||||
|
[m]
|
||||||
|
(reduce-kv (fn [acc _ v]
|
||||||
|
(cond
|
||||||
|
(map? v) (+ acc (count-leaves v))
|
||||||
|
(vector? v) (+ acc (count v))
|
||||||
|
:else acc))
|
||||||
|
0
|
||||||
|
m))
|
||||||
|
|
||||||
(mf/defc components-group
|
(mf/defc components-group
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
[{:keys [file-id prefix groups open-groups force-open? renaming listing-thumbs? selected on-asset-click
|
[{:keys [file-id prefix groups open-groups force-open? renaming listing-thumbs? selected on-asset-click
|
||||||
@ -192,10 +205,11 @@
|
|||||||
selected-full))
|
selected-full))
|
||||||
|
|
||||||
components (not-empty (get groups "" []))
|
components (not-empty (get groups "" []))
|
||||||
can-combine? (and is-local
|
can-combine? (mf/with-memo [is-local groups components]
|
||||||
(> (count components) 1)
|
(and is-local
|
||||||
(not-any? ctc/is-variant? components)
|
(> (count-leaves groups) 1)
|
||||||
(apply = (map :main-instance-page components)))
|
(not-any? ctc/is-variant? components)
|
||||||
|
(apply = (map :main-instance-page components))))
|
||||||
on-drag-enter
|
on-drag-enter
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps dragging* prefix selected-paths is-local drag-data*)
|
(mf/deps dragging* prefix selected-paths is-local drag-data*)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user