From a27c4e52dfff6afcc0863bf2f7dbaaeeb8add927 Mon Sep 17 00:00:00 2001 From: shenlan Date: Sun, 21 Sep 2025 20:42:00 +0800 Subject: [PATCH] feat: make insight sidebar collapsible (#279) --- .../app/components/insight/layout/Sidebar.tsx | 264 ++++++++++++------ ui/homepage/app/insight/page.tsx | 36 ++- 2 files changed, 208 insertions(+), 92 deletions(-) diff --git a/ui/homepage/app/components/insight/layout/Sidebar.tsx b/ui/homepage/app/components/insight/layout/Sidebar.tsx index dbe7bf5..95dc27f 100644 --- a/ui/homepage/app/components/insight/layout/Sidebar.tsx +++ b/ui/homepage/app/components/insight/layout/Sidebar.tsx @@ -1,5 +1,7 @@ 'use client' +import { BarChart3, BellRing, Compass, Layers, Sparkles, type LucideIcon, PanelLeftClose, PanelLeftOpen, EyeOff } from 'lucide-react' + import { QueryLanguage, TopologyMode } from '../../insight/store/urlState' interface SidebarProps { @@ -8,15 +10,18 @@ interface SidebarProps { onSelectSection: (section: string) => void onTopologyChange: (mode: TopologyMode) => void onToggleLanguage: (language: QueryLanguage) => void + onToggleCollapse: () => void + onHide: () => void activeSection: string + collapsed: boolean } -const sections = [ - { id: 'topology', label: 'Topology' }, - { id: 'explore', label: 'Explore' }, - { id: 'visualize', label: 'Visualize' }, - { id: 'slo', label: 'SLO & Alerts' }, - { id: 'ai', label: 'AI Assistant' } +const sections: { id: string; label: string; icon: LucideIcon }[] = [ + { id: 'topology', label: 'Topology', icon: Layers }, + { id: 'explore', label: 'Explore', icon: Compass }, + { id: 'visualize', label: 'Visualize', icon: BarChart3 }, + { id: 'slo', label: 'SLO & Alerts', icon: BellRing }, + { id: 'ai', label: 'AI Assistant', icon: Sparkles } ] const topologyOptions: { id: TopologyMode; label: string; hint: string }[] = [ @@ -37,91 +42,184 @@ export function Sidebar({ activeSection, onSelectSection, onTopologyChange, - onToggleLanguage + onToggleLanguage, + onToggleCollapse, + onHide, + collapsed }: SidebarProps) { return ( -