diff --git a/frontend/src/components/layout/Sidebar.tsx b/frontend/src/components/layout/Sidebar.tsx index b48c5b88..ddf9b6e3 100644 --- a/frontend/src/components/layout/Sidebar.tsx +++ b/frontend/src/components/layout/Sidebar.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useRef, useState } from 'react' +import { useCallback, useEffect, useRef, useState, type PointerEvent as ReactPointerEvent } from 'react' import { Link, useLocation } from 'react-router-dom' import type { LucideIcon } from 'lucide-react' import { @@ -185,6 +185,33 @@ export function Sidebar() { if (flyoutTimeout.current) clearTimeout(flyoutTimeout.current) } + /* ── Drawer resize ───────────────────────────────── */ + + const [drawerWidth, setDrawerWidth] = useState(240) + const isResizing = useRef(false) + + const handleResizeStart = (e: ReactPointerEvent) => { + e.preventDefault() + isResizing.current = true + const startX = e.clientX + const startWidth = drawerWidth + + const onMove = (ev: globalThis.PointerEvent) => { + if (!isResizing.current) return + const newWidth = Math.max(180, Math.min(400, startWidth + (ev.clientX - startX))) + setDrawerWidth(newWidth) + } + + const onUp = () => { + isResizing.current = false + document.removeEventListener('pointermove', onMove) + document.removeEventListener('pointerup', onUp) + } + + document.addEventListener('pointermove', onMove) + document.addEventListener('pointerup', onUp) + } + /* Close flyout on Escape */ useEffect(() => { const handleKey = (e: KeyboardEvent) => { @@ -247,45 +274,7 @@ export function Sidebar() { - {/* Flyout panel (icon rail only) */} - {hasChildren && !sidebarPinned && flyoutIndex === key && ( -