mirror of
https://github.com/penpot/penpot.git
synced 2026-04-30 13:49:06 +00:00
Reviewer follow-up on PR #9151. The "Delete group" handler was duplicated across the three assets-panel sections (colors, typographies, components), each carrying the same skeleton — filter by group path, build an undo-id, run the deletes inside one transaction, and show the same confirm modal — with only the path predicate and the per-asset delete event differing. Add `app.main.ui.workspace.sidebar.assets.common/make-delete-asset-group-fn` that takes the differing parts as options: - `:assets` collection to filter. - `:on-clear-selection` invoked before the deletes. - `:delete-events` `(fn [matching-assets] => seq-of-events)`. - `:path-filter` predicate (defaults to `str/starts-with?`), overridden to `cpn/inside-path?` for components so nested group paths match the same way the existing ungroup/combine helpers do. The factory returns `(fn [path] …)` so each call site stays a straight `mf/use-fn`. The variant-container dedup in components (one `delete-shapes` per container, not one per sibling variant) moves into that section's `:delete-events` fn and is unchanged in behavior. Cleanup ------- The `:as i18n` alias is no longer needed in any of the three section files (its only use was `i18n/c` for the modal count, which the helper now handles); reduced to `:refer [tr]`. Github #9141 Signed-off-by: FairyPigDev <luislee3108@gmail.com> Co-authored-by: Andrey Antukh <niwi@niwi.nz>