From 5dc3ec88d4f99fe7f34d005f2bcc2e20a0914fb4 Mon Sep 17 00:00:00 2001
From: DrSmoothl <1787882683@qq.com>
Date: Sun, 28 Jun 2026 23:29:25 +0800
Subject: [PATCH] =?UTF-8?q?fix(webui):=20smooth=20sidebar=20collapse=20?=
=?UTF-8?q?=E2=80=94=20no=20reflow,=20centered=20icons,=20pin=20button?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The hover-rail flipped its content to a collapsed layout instantly while the
width animated, so on every expand/collapse icons jumped toward the top-left and
labels flashed in, wrapped super-tall, then settled — and the collapsed rail
leaked the first glyph of every label plus hard-clipped highlight bars.
Lay the rail content out at a fixed width and let the aside clip it: nothing
reflows during the width animation. Icons live in a fixed centered column (never
move); labels stay mounted with nowrap and just fade out when collapsed (no
wrap, no leak); the active pill and update banner render their background as an
absolute layer that becomes a centered squircle on the rail instead of a
hard-clipped bar.
Adds the promised pin toggle to the sidebar footer (desktop) — mirrors the
「钉住侧栏展开」 appearance setting: pinned keeps the rail open, unpinned returns
to hover-to-peek.
---
.../src/components/layout/main-layout.tsx | 8 +-
.../webui/src/components/layout/sidebar.tsx | 141 +++++++++++-------
2 files changed, 97 insertions(+), 52 deletions(-)
diff --git a/packages/webui/src/components/layout/main-layout.tsx b/packages/webui/src/components/layout/main-layout.tsx
index 512abe9f..81515f8e 100644
--- a/packages/webui/src/components/layout/main-layout.tsx
+++ b/packages/webui/src/components/layout/main-layout.tsx
@@ -66,7 +66,13 @@ export function MainLayout({ status, onLogout, children }: MainLayoutProps) {
}}
className="relative h-full shrink-0 overflow-hidden"
>
-
+ {/* Fixed-width inner: the rail's content is ALWAYS laid out at the
+ expanded width and the aside simply clips it as `width` animates.
+ Nothing reflows during the transition, so icons never shift and
+ labels never wrap — they're revealed/clipped, not re-laid-out. */}
+
+ {/* Brand — logo sits in a fixed 48px column centred in the collapsed
+ rail; the wordmark to its right is clipped (never unmounted) when the
+ rail narrows. */}
+