fix: add page navigation to Sidebar + wire in camel SVG logo

- Add Navigation section (Dashboard, Metrics, Agents) with useNavigate
- Route items now navigate to /routes/:id
- Active state highlights current page based on location.pathname
- Replace inline CamelIcon with actual camel-logo.svg asset

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-18 11:01:40 +01:00
parent dee4b681d3
commit 883e4b565d
2 changed files with 64 additions and 31 deletions

View File

@@ -17,6 +17,13 @@
flex-shrink: 0; flex-shrink: 0;
} }
.logoImg {
width: 28px;
height: 24px;
color: var(--amber-light);
filter: brightness(0) saturate(100%) invert(76%) sepia(30%) saturate(400%) hue-rotate(5deg) brightness(95%);
}
.brand { .brand {
font-family: var(--font-mono); font-family: var(--font-mono);
font-weight: 600; font-weight: 600;
@@ -132,6 +139,18 @@
padding-left: 22px; padding-left: 22px;
} }
.navIcon {
font-size: 14px;
width: 18px;
text-align: center;
color: var(--sidebar-muted);
flex-shrink: 0;
}
.item.active .navIcon {
color: var(--amber-light);
}
.routeArrow { .routeArrow {
color: var(--sidebar-muted); color: var(--sidebar-muted);
font-size: 10px; font-size: 10px;

View File

@@ -1,5 +1,7 @@
import { useState } from 'react' import { useState } from 'react'
import { useNavigate, useLocation } from 'react-router-dom'
import styles from './Sidebar.module.css' import styles from './Sidebar.module.css'
import camelLogoUrl from '../../../assets/camel-logo.svg'
export interface App { export interface App {
id: string id: string
@@ -49,34 +51,19 @@ function HealthDot({ status }: { status: 'live' | 'stale' | 'dead' }) {
) )
} }
// Camel SVG silhouette interface NavItem {
function CamelIcon() { id: string
return ( label: string
<svg path: string
width="28" icon: string
height="24"
viewBox="0 0 28 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
>
{/* Simple camel silhouette */}
<path
d="M4 20 L4 16 L6 14 L6 12 C6 10 7 9 9 9 L10 8 C10 6 11 5 12 5 C12 3 13 2 14 2 C15 2 15.5 3 15 5 C16 5 17 6 17 8 L18 9 C20 9 21 10 21 12 L21 14 L22 14 L22 12 C22 10 23 9 24 9 L24 20"
fill="var(--amber-light)"
stroke="var(--amber)"
strokeWidth="0.5"
/>
<path
d="M4 20 L24 20"
stroke="var(--amber)"
strokeWidth="1"
strokeLinecap="round"
/>
</svg>
)
} }
const NAV_ITEMS: NavItem[] = [
{ id: 'dashboard', label: 'Dashboard', path: '/', icon: '▦' },
{ id: 'metrics', label: 'Metrics', path: '/metrics', icon: '◔' },
{ id: 'agents', label: 'Agents', path: '/agents', icon: '⬡' },
]
export function Sidebar({ export function Sidebar({
apps, apps,
routes, routes,
@@ -85,6 +72,8 @@ export function Sidebar({
onItemClick, onItemClick,
}: SidebarProps) { }: SidebarProps) {
const [search, setSearch] = useState('') const [search, setSearch] = useState('')
const navigate = useNavigate()
const location = useLocation()
const liveCount = agents.filter((a) => a.status === 'live').length const liveCount = agents.filter((a) => a.status === 'live').length
const agentBadge = `${liveCount}/${agents.length} live` const agentBadge = `${liveCount}/${agents.length} live`
@@ -96,8 +85,8 @@ export function Sidebar({
return ( return (
<aside className={styles.sidebar}> <aside className={styles.sidebar}>
{/* Logo */} {/* Logo */}
<div className={styles.logo}> <div className={styles.logo} onClick={() => navigate('/')} style={{ cursor: 'pointer' }}>
<CamelIcon /> <img src={camelLogoUrl} alt="" aria-hidden="true" className={styles.logoImg} />
<div> <div>
<span className={styles.brand}>cameleer</span> <span className={styles.brand}>cameleer</span>
<span className={styles.version}>v3.2.1</span> <span className={styles.version}>v3.2.1</span>
@@ -125,6 +114,31 @@ export function Sidebar({
{/* Scrollable nav area */} {/* Scrollable nav area */}
<div className={styles.navArea}> <div className={styles.navArea}>
{/* Top-level navigation */}
<div className={styles.section}>Navigation</div>
<div className={styles.items}>
{NAV_ITEMS.map((nav) => (
<div
key={nav.id}
className={[
styles.item,
location.pathname === nav.path ? styles.active : '',
].filter(Boolean).join(' ')}
onClick={() => navigate(nav.path)}
role="button"
tabIndex={0}
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') navigate(nav.path) }}
>
<span className={styles.navIcon}>{nav.icon}</span>
<div className={styles.itemInfo}>
<div className={styles.itemName}>{nav.label}</div>
</div>
</div>
))}
</div>
<div className={styles.divider} />
{/* Applications section */} {/* Applications section */}
<div className={styles.section}>Applications</div> <div className={styles.section}>Applications</div>
<div className={styles.items}> <div className={styles.items}>
@@ -166,15 +180,15 @@ export function Sidebar({
className={[ className={[
styles.item, styles.item,
styles.indented, styles.indented,
activeItem === route.id ? styles.active : '', activeItem === route.id || location.pathname === `/routes/${route.id}` ? styles.active : '',
] ]
.filter(Boolean) .filter(Boolean)
.join(' ')} .join(' ')}
onClick={() => onItemClick?.(route.id)} onClick={() => { onItemClick?.(route.id); navigate(`/routes/${route.id}`) }}
role="button" role="button"
tabIndex={0} tabIndex={0}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') onItemClick?.(route.id) if (e.key === 'Enter' || e.key === ' ') { onItemClick?.(route.id); navigate(`/routes/${route.id}`) }
}} }}
> >
<span className={styles.routeArrow}>&#9656;</span> <span className={styles.routeArrow}>&#9656;</span>