diff --git a/docs/design-system-update-instructions.md b/docs/design-system-update-instructions.md new file mode 100644 index 00000000..ee2a2153 --- /dev/null +++ b/docs/design-system-update-instructions.md @@ -0,0 +1,122 @@ +# Design System Update Instructions + +These changes are needed in `@cameleer/design-system` to replace workarounds in cameleer3-server's UI. + +## 1. Sidebar: Add `onNavigate` callback prop (HIGH PRIORITY) + +### Problem + +The Sidebar component navigates internally using React Router `` components with hardcoded paths (`/apps/:appId`, `/apps/:appId/:routeId`, `/agents/:appId/:instanceId`). The consuming app (cameleer3-server) now uses a different URL structure (`/exchanges/:appId`, `/runtime/:appId/:instanceId`) and needs to intercept and re-route sidebar navigation. + +The current workaround wraps Sidebar in a `
` that intercepts anchor clicks via event delegation and prevents default navigation. This is fragile — it depends on the Sidebar rendering `` elements and breaks if the internal markup changes. + +### Required Change + +Add an optional `onNavigate` callback to `SidebarProps`: + +```typescript +interface SidebarProps { + apps: SidebarApp[]; + className?: string; + onNavigate?: (path: string) => void; // NEW +} +``` + +**Behavior:** +- When `onNavigate` is NOT provided: Sidebar works exactly as today (internal `` navigation). No breaking change. +- When `onNavigate` IS provided: Instead of using `` or `navigate()`, call `onNavigate(path)` with the path that would have been navigated to. The consuming app decides where to actually navigate. + +**Example paths passed to `onNavigate`:** +- App click: `onNavigate('/apps/order-svc')` +- Route click: `onNavigate('/apps/order-svc/process-order')` +- Agent click: `onNavigate('/agents/order-svc/agent-1')` + +The consuming app can then translate these paths to its own URL structure. + +**Implementation hint:** In the Sidebar component, wherever you have `` or `navigate(path)`, check if `onNavigate` is defined. If yes, render a `