/**
* Sidebar Component
* Navigation sidebar with menu items.
* No longer fixed - sits inside the flex layout below the title bar.
*/
import { NavLink } from 'react-router-dom';
import {
Home,
MessageSquare,
Radio,
Puzzle,
Clock,
Settings,
ChevronLeft,
ChevronRight,
Terminal,
ExternalLink,
} from 'lucide-react';
import { cn } from '@/lib/utils';
import { useSettingsStore } from '@/stores/settings';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
interface NavItemProps {
to: string;
icon: React.ReactNode;
label: string;
badge?: string;
collapsed?: boolean;
}
function NavItem({ to, icon, label, badge, collapsed }: NavItemProps) {
return (
cn(
'flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors',
'hover:bg-accent hover:text-accent-foreground',
isActive
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground',
collapsed && 'justify-center px-2'
)
}
>
{icon}
{!collapsed && (
<>
{label}
{badge && (
{badge}
)}
>
)}
);
}
export function Sidebar() {
const sidebarCollapsed = useSettingsStore((state) => state.sidebarCollapsed);
const setSidebarCollapsed = useSettingsStore((state) => state.setSidebarCollapsed);
const devModeUnlocked = useSettingsStore((state) => state.devModeUnlocked);
const openDevConsole = async () => {
try {
const result = await window.electron.ipcRenderer.invoke('gateway:getControlUiUrl') as {
success: boolean;
url?: string;
error?: string;
};
if (result.success && result.url) {
window.electron.openExternal(result.url);
} else {
console.error('Failed to get Dev Console URL:', result.error);
}
} catch (err) {
console.error('Error opening Dev Console:', err);
}
};
const navItems = [
{ to: '/', icon: , label: 'Chat' },
{ to: '/cron', icon: , label: 'Cron Tasks' },
{ to: '/skills', icon: , label: 'Skills' },
{ to: '/channels', icon: , label: 'Channels' },
{ to: '/dashboard', icon: , label: 'Dashboard' },
{ to: '/settings', icon: , label: 'Settings' },
];
return (
);
}