refactor(inventory): update Sidebar demo to compound API

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-02 18:10:09 +02:00
parent 9fa7eb129d
commit 18bf644040

View File

@@ -1,6 +1,9 @@
import styles from './LayoutSection.module.css'
import { Sidebar } from '../../../design-system/layout/Sidebar/Sidebar'
import type { SidebarApp } from '../../../design-system/layout/Sidebar/Sidebar'
import { SidebarTree } from '../../../design-system/layout/Sidebar/SidebarTree'
import type { SidebarTreeNode } from '../../../design-system/layout/Sidebar/SidebarTree'
import { StatusDot } from '../../../design-system/primitives/StatusDot/StatusDot'
import { Box, Settings, FileText, ChevronRight } from 'lucide-react'
import { TopBar } from '../../../design-system/layout/TopBar/TopBar'
// ── DemoCard helper ──────────────────────────────────────────────────────────
@@ -22,42 +25,42 @@ function DemoCard({ id, title, description, children }: DemoCardProps) {
)
}
// ── Sample data (hierarchical) ───────────────────────────────────────────────
// ── Sample tree nodes ────────────────────────────────────────────────────────
const SAMPLE_APPS: SidebarApp[] = [
const SAMPLE_APP_NODES: SidebarTreeNode[] = [
{
id: 'app1',
name: 'cameleer-prod',
health: 'live' as const,
exchangeCount: 14320,
routes: [
{ id: 'r1', name: 'order-ingest', exchangeCount: 5421 },
{ id: 'r2', name: 'payment-validate', exchangeCount: 3102 },
],
agents: [
{ id: 'ag1', name: 'agent-prod-1', status: 'live' as const, tps: 42 },
{ id: 'ag2', name: 'agent-prod-2', status: 'live' as const, tps: 38 },
label: 'cameleer-prod',
icon: <StatusDot status="live" />,
badge: '14.3k',
path: '/apps/app1',
starrable: true,
starKey: 'app:app1',
children: [
{ id: 'app1/r1', label: 'order-ingest', icon: <ChevronRight size={12} />, badge: '5,421', path: '/apps/app1/r1' },
{ id: 'app1/r2', label: 'payment-validate', icon: <ChevronRight size={12} />, badge: '3,102', path: '/apps/app1/r2' },
],
},
{
id: 'app2',
name: 'cameleer-staging',
health: 'stale' as const,
exchangeCount: 871,
routes: [
{ id: 'r3', name: 'notify-customer', exchangeCount: 2201 },
],
agents: [
{ id: 'ag3', name: 'agent-staging-1', status: 'stale' as const, tps: 5 },
label: 'cameleer-staging',
icon: <StatusDot status="stale" />,
badge: '871',
path: '/apps/app2',
starrable: true,
starKey: 'app:app2',
children: [
{ id: 'app2/r3', label: 'notify-customer', icon: <ChevronRight size={12} />, badge: '2,201', path: '/apps/app2/r3' },
],
},
{
id: 'app3',
name: 'cameleer-dev',
health: 'dead' as const,
exchangeCount: 42,
routes: [],
agents: [],
label: 'cameleer-dev',
icon: <StatusDot status="dead" />,
badge: '42',
path: '/apps/app3',
starrable: true,
starKey: 'app:app3',
},
]
@@ -99,10 +102,19 @@ export function LayoutSection() {
<DemoCard
id="sidebar"
title="Sidebar"
description="Navigation sidebar with hierarchical app/route/agent trees, starring, search filter, and bottom links."
description="Composable navigation sidebar with sections, tree navigation, and icon-rail collapse mode."
>
<div className={styles.sidebarPreview}>
<Sidebar apps={SAMPLE_APPS} />
<Sidebar>
<Sidebar.Header logo={<span style={{ fontSize: 20 }}>&#x1F42A;</span>} title="cameleer" version="v3.2.1" />
<Sidebar.Section label="Applications" icon={<Box size={14} />} open={true} onToggle={() => {}} active={false}>
<SidebarTree nodes={SAMPLE_APP_NODES} isStarred={() => false} onToggleStar={() => {}} />
</Sidebar.Section>
<Sidebar.Footer>
<Sidebar.FooterLink icon={<Settings size={14} />} label="Admin" />
<Sidebar.FooterLink icon={<FileText size={14} />} label="API Docs" />
</Sidebar.Footer>
</Sidebar>
</div>
</DemoCard>