From 9fd6abb8eabaa9d93f5507c0ea17a01891df6db1 Mon Sep 17 00:00:00 2001 From: Fini Date: Sat, 9 May 2026 20:59:48 +0800 Subject: [PATCH] fix(ai): sidebar-nav-v1 also canonicalises wrong-glyph icons via label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: f1923ff1 added coerceNavTabIcon to bottom-nav-v1 and noted that sidebar-nav-v1 should adopt the same helper. Without it, a sidebar nav with \`{ label: 'Profile', icon: 'profile' }\` would still render a placeholder circle (resolver doesn't know "profile" is a known wrong-glyph alias for "user") instead of the lucide:user glyph. What: import coerceNavTabIcon and apply it in buildItemV1 before stamping iconFontName onto the Icon child node. Same convention single-sourced. Existing 1435 tests still pass — no test relied on the prior pass-through behavior for known wrong-glyph names. --- packages/pen-core/src/element-builders/sidebar-nav-v1.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/pen-core/src/element-builders/sidebar-nav-v1.ts b/packages/pen-core/src/element-builders/sidebar-nav-v1.ts index 667cb582c..290f2544f 100644 --- a/packages/pen-core/src/element-builders/sidebar-nav-v1.ts +++ b/packages/pen-core/src/element-builders/sidebar-nav-v1.ts @@ -1,3 +1,4 @@ +import { coerceNavTabIcon } from './coerce-params.js'; import type { ElementTree } from './helpers.js'; import { resolveTheme, type V1Theme } from './resolve-theme.js'; @@ -99,6 +100,10 @@ function buildItemV1( inactiveLabelColor: string, ): ElementTree { const active = item.active === true; + // Same wrong-glyph swap pattern as bottom-nav-v1 (Cart→shopping-cart, + // Profile→user, etc). Reuses the shared helper so the convention is + // single-sourced. + const icon = coerceNavTabIcon(item.label, item.icon, 'buildSidebarNavV1'); const node: ElementTree = { type: 'frame', name: `Item (${item.label})`, @@ -115,7 +120,7 @@ function buildItemV1( type: 'icon_font', name: 'Icon', role: 'sidebar-nav-icon', - iconFontName: item.icon, + iconFontName: icon, iconFontFamily: 'lucide', width: 18, height: 18,