From cb7daa77db1f40ad34849a895567136b1542c151 Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Fri, 22 May 2026 00:31:55 +0800 Subject: [PATCH] feat(webui): refine collapsible sidebar --- webui/src/App.tsx | 25 +- webui/src/components/Sidebar.tsx | 259 +++++++++++++------ webui/src/components/thread/ThreadHeader.tsx | 25 +- webui/src/tests/app-layout.test.tsx | 10 +- 4 files changed, 225 insertions(+), 94 deletions(-) diff --git a/webui/src/App.tsx b/webui/src/App.tsx index c303446e2..aa3cf0cf8 100644 --- a/webui/src/App.tsx +++ b/webui/src/App.tsx @@ -43,6 +43,7 @@ const SIDEBAR_STORAGE_KEY = "nanobot-webui.sidebar"; const COMPLETED_RUNS_STORAGE_KEY = "nanobot-webui.sidebar.completed-runs.v1"; const RESTART_STARTED_KEY = "nanobot-webui.restartStartedAt"; const SIDEBAR_WIDTH = 272; +const SIDEBAR_RAIL_WIDTH = 56; const TOKEN_REFRESH_MARGIN_MS = 30_000; const TOKEN_REFRESH_MIN_DELAY_MS = 5_000; type ShellView = "chat" | "settings"; @@ -411,6 +412,10 @@ function Shell({ setDesktopSidebarOpen(false); }, []); + const openDesktopSidebar = useCallback(() => { + setDesktopSidebarOpen(true); + }, []); + const closeMobileSidebar = useCallback(() => { setMobileSidebarOpen(false); }, []); @@ -732,17 +737,19 @@ function Shell({ "relative z-20 hidden shrink-0 overflow-hidden lg:block", "transition-[width] duration-300 ease-out", )} - style={{ width: desktopSidebarOpen ? SIDEBAR_WIDTH : 0 }} + style={{ + width: desktopSidebarOpen ? SIDEBAR_WIDTH : SIDEBAR_RAIL_WIDTH, + }} >