From e1dd2bec90b28b014fe90b16aede76f3be399825 Mon Sep 17 00:00:00 2001 From: scheinriese Date: Thu, 7 May 2026 13:39:14 +0200 Subject: [PATCH] feat: color picker in asset-picker topbar (Avatar mode) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The icon-picker's color swatch only lived at level 1 — to recolor an avatar from inside the asset-picker the user had to click Back, recolor, then drill into Custom > Avatar again. Surface the same trigger in the asset-picker topbar so the round trip collapses to one click. - Trigger renders only when mode = :avatar; image assets aren't tinted so showing it in Image mode would be misleading. Toggling segment to Image dismisses an open color popover by id (:asset-picker-color) so it doesn't orphan over an unrelated topbar. - The color-picker component itself is unchanged besides accepting an optional :popup-id opt and threading it into shui/popup-show!. The asset-picker observes the same `*color` rum atom the icon-picker topbar uses, so backing out reflects the new color in the parent immediately — no state duplication. - Hover-preview wired through preview-target-db-id, same as the parent. - Layout: bundles color + trash inside `.asset-picker-topbar-actions` in the topbar's right grid cell. Class is intentionally distinct from `.asset-picker-actions` (the floating bottom bar with "Add image via URL" / "Upload image"); reusing the latter would inherit its `position: absolute; bottom: 0` and yank the topbar group off-screen. Forward-declares `color-picker` near the asset-picker so the top-to-bottom CLJS compile resolves the call site at line 3375 even though the definition lives at line 5042. Without the declare, CLJS emits a direct property reference that's undefined at runtime, the `(color-picker …)` call throws, and the entire `.asset-picker-topbar- actions` subtree fails to mount (which manifested as both the color trigger AND the trash going missing). Co-Authored-By: Claude Opus 4.7 --- src/main/frontend/components/icon.cljs | 123 +++++++++++++++++++------ src/main/frontend/components/icon.css | 12 ++- 2 files changed, 107 insertions(+), 28 deletions(-) diff --git a/src/main/frontend/components/icon.cljs b/src/main/frontend/components/icon.cljs index 6367b4e487..ddb89f141f 100644 --- a/src/main/frontend/components/icon.cljs +++ b/src/main/frontend/components/icon.cljs @@ -2806,9 +2806,13 @@ ;; Fall back to async API. (