void; }) { const handleMouseDown = (e: React.MouseEvent) => { e.preventDefault(); const startX = e.clientX; const startWidth = currentWidth; + let finalWidth = startWidth; + + // Disable padding transition while dragging to prevent animation lag + if (mainRef.current) { + mainRef.current.style.transition = 'none'; + } const handleMouseMove = (moveEvent: MouseEvent) => { - onWidthChange(startWidth + (moveEvent.clientX - startX)); + const raw = startWidth + (moveEvent.clientX - startX); + finalWidth = Math.max(MIN_SIDEBAR_WIDTH, Math.min(MAX_SIDEBAR_WIDTH, raw)); + // Direct DOM writes — bypasses React state for lag-free tracking + if (sidebarRef.current) { + sidebarRef.current.style.width = `${finalWidth}px`; + } + if (mainRef.current) { + mainRef.current.style.paddingLeft = `${finalWidth}px`; + } }; const handleMouseUp = () => { document.body.style.cursor = ''; document.body.style.userSelect = ''; + // Restore transition so sidebar toggle animates smoothly again + if (mainRef.current) { + mainRef.current.style.transition = ''; + } document.removeEventListener('mousemove', handleMouseMove); document.removeEventListener('mouseup', handleMouseUp); + // Commit final width to React state (triggers localStorage persist) + onWidthChange(finalWidth); }; document.body.style.cursor = 'col-resize'; diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index 4320b507..cba27246 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -283,7 +283,6 @@ function GroupHeader({ className=" w-full flex items-center gap-2 px-4 py-2 text-xs font-semibold text-gray-300 uppercase tracking-wider - border-b border-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-cyan-500 transition-colors "