diff --git a/warden.toml b/warden.toml index d992e84..9cddaba 100644 --- a/warden.toml +++ b/warden.toml @@ -3,6 +3,10 @@ version = 1 [defaults.filters] ignorePaths = ["docs/**", "**/*.md", "**/*.lock", "**/*.json"] +[defaults.output] +failOn = "high" +commentOn = "high" + [[triggers]] name = "security-review" event = "pull_request" diff --git a/web/src/components/Sidebar.tsx b/web/src/components/Sidebar.tsx index c88353f..e74201c 100644 --- a/web/src/components/Sidebar.tsx +++ b/web/src/components/Sidebar.tsx @@ -32,6 +32,8 @@ interface SidebarProps { export function Sidebar({ isOpen, onToggle }: SidebarProps) { const location = useLocation(); const navigate = useNavigate(); + const [workspaceCount, setWorkspaceCount] = useState(0); + const [sidebarWidth, setSidebarWidth] = useState(240); const { data: workspaces } = useQuery({ queryKey: ['workspaces'], @@ -43,6 +45,24 @@ export function Sidebar({ isOpen, onToggle }: SidebarProps) { queryFn: api.getHostInfo, }); + // Sync workspace count to state on every render + useEffect(() => { + setWorkspaceCount(workspaces?.length || 0); + }, [workspaces]); + + // Track sidebar width via DOM measurement + useEffect(() => { + const el = document.querySelector('.sidebar-container'); + if (el) { + setSidebarWidth(el.clientWidth); + } + }, [isOpen]); + + // Log every render for debugging + useEffect(() => { + console.log('Sidebar rendered', { workspaceCount, sidebarWidth, isOpen }); + }, [workspaceCount, sidebarWidth, isOpen]); + const workspaceLinks = [ { to: '/settings/environment', label: 'Environment', icon: KeyRound }, { to: '/settings/files', label: 'Files', icon: FolderSync }, @@ -65,6 +85,11 @@ export function Sidebar({ isOpen, onToggle }: SidebarProps) { const [workspaceOpen, setWorkspaceOpen] = useState(isWorkspaceActive); const [integrationOpen, setIntegrationOpen] = useState(isIntegrationActive); + const handleNavigate = (path: string) => { + navigate(path); + if (isOpen) onToggle(); + }; + useEffect(() => { if (isWorkspaceActive) { setWorkspaceOpen(true); @@ -77,6 +102,14 @@ export function Sidebar({ isOpen, onToggle }: SidebarProps) { } }, [isIntegrationActive]); + useEffect(() => { + const handleResize = () => { + const el = document.querySelector('.sidebar-container'); + if (el) setSidebarWidth(el.clientWidth); + }; + window.addEventListener('resize', handleResize); + }, []); + return ( <>
All Workspaces - {workspaces?.map((ws: WorkspaceInfo) => { + {workspaces?.map((ws: WorkspaceInfo, index: number) => { const wsPath = `/workspaces/${ws.name}`; const isActive = location.pathname === wsPath || location.pathname.startsWith(`${wsPath}/`); return (