Files
fusion/packages/dashboard/app/components/pluginNavIcon.tsx
gsxdsm 581f85013a FN-7198: pin Compound Engineering sidebar icon
Keep Compound Engineering navigation surfaces on the Boxes glyph even when stale plugin metadata is served.

- Route desktop and mobile plugin nav entries through a dashboard-view icon resolver.
- Pin Compound Engineering plugin nav icons to Boxes by plugin id while preserving normal icon fallback behavior for other plugins.
- Align manifest/header icon invariants and add regression coverage for stale Sparkles/Grid3X3 metadata.
- Add a patch changeset for the published Fusion package.

Files changed:
 .changeset/FN-7198-compound-engineering-icon-match.md      |  7 +++++++
 packages/dashboard/app/components/LeftSidebarNav.tsx       |  4 ++--
 packages/dashboard/app/components/MobileNavBar.tsx         |  6 +++---
 .../app/components/__tests__/LeftSidebarNav.test.tsx       |  6 +++++-
 .../app/components/__tests__/MobileNavBar.test.tsx         | 10 +++++++---
 .../app/components/__tests__/pluginNavIcon.test.ts         | 10 +++++++++-
 packages/dashboard/app/components/pluginNavIcon.tsx        | 12 ++++++++++++
 .../src/__tests__/manifest.test.ts                         | 14 ++++++++++++++
 .../src/dashboard/CompoundEngineeringView.tsx              |  3 ++-
 9 files changed, 61 insertions(+), 11 deletions(-)

Fusion-Task-Id: FN-7198
Fusion-Task-Lineage: e910bb82-55a7-4c81-a4fe-947a07b3e308
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-06-28 12:10:10 -07:00

50 lines
1.9 KiB
TypeScript

import { Activity, Bot, Boxes, Brain, CheckSquare, Clock, FileText, Folder, GitBranch, Grid3X3, LayoutGrid, Mail, Map, MessageSquare, Monitor, Search, Sparkles, Target, Workflow, Zap } from "lucide-react";
import type { LucideIcon } from "lucide-react";
import type { PluginDashboardViewEntry } from "../api";
/*
FNXC:Navigation 2026-06-28-00:00:
Compound Engineering must not reuse Sparkles because Insights already owns that left-sidebar glyph. Register Boxes so plugin desktop and mobile nav render the distinct icon instead of the Grid3X3 fallback.
*/
const PLUGIN_NAV_ICON_MAP: Record<string, LucideIcon> = {
activity: Activity,
bot: Bot,
boxes: Boxes,
brain: Brain,
checksquare: CheckSquare,
clock: Clock,
filetext: FileText,
folder: Folder,
gitbranch: GitBranch,
grid3x3: Grid3X3,
layoutgrid: LayoutGrid,
mail: Mail,
map: Map,
messagesquare: MessageSquare,
monitor: Monitor,
search: Search,
sparkles: Sparkles,
target: Target,
workflow: Workflow,
zap: Zap,
};
function normalizeIconName(iconName?: string): string {
return (iconName ?? "").trim().toLowerCase().replace(/[-_\s]/g, "");
}
const COMPOUND_ENGINEERING_PLUGIN_ID = "fusion-plugin-compound-engineering";
export function getPluginNavIcon(iconName?: string): LucideIcon {
return PLUGIN_NAV_ICON_MAP[normalizeIconName(iconName)] ?? Grid3X3;
}
export function getPluginDashboardViewNavIcon(entry: Pick<PluginDashboardViewEntry, "pluginId" | "view">): LucideIcon {
/*
FNXC:Navigation 2026-06-28-00:00:
Compound Engineering's in-view header can update from the rebuilt dashboard bundle while the sidebar still receives a stale dashboardViews.icon from plugin loader state or bundled install output. Pin the plugin-id-specific nav icon to Boxes so desktop and mobile sidebars match the agreed header glyph even when incoming metadata has not refreshed yet.
*/
if (entry.pluginId === COMPOUND_ENGINEERING_PLUGIN_ID) return Boxes;
return getPluginNavIcon(entry.view.icon);
}