From 2fc2c17b054025cd7802d7c3f321d8969d2aca8d Mon Sep 17 00:00:00 2001 From: truewhile <62226914+truewhile@users.noreply.github.com> Date: Wed, 2 Sep 2026 10:48:58 +0800 Subject: [PATCH] fix: prevent mobile sidebar nav items from stacking on short screens (#7) Narrow drawers rendered media links in a flex-1 overflow region above a non-shrinking admin block, so the browse items were clipped into a compressed active pill. Scroll media and admin together, and distinguish /libraries from /libraries?from=admin when highlighting. Co-authored-by: Cursor Agent Co-authored-by: truewhile --- web/src/components/Layout.tsx | 7 +- web/src/components/LayoutSections.tsx | 4 +- web/src/components/LayoutSidebarContent.tsx | 42 ++++++------ web/src/components/LayoutSidebarNav.tsx | 73 ++++++++++----------- web/src/components/layoutNavigation.ts | 38 +++++++++++ 5 files changed, 101 insertions(+), 63 deletions(-) diff --git a/web/src/components/Layout.tsx b/web/src/components/Layout.tsx index b13a808..9016732 100644 --- a/web/src/components/Layout.tsx +++ b/web/src/components/Layout.tsx @@ -8,16 +8,15 @@ import { LayoutWorkspace, } from './LayoutSections' import { MobileBottomNav } from './MobileBottomNav' -import { isPlayerRoute, shouldShowMobileBottomNav } from './layoutNavigation' +import { isAdminEntrySearch, isPlayerRoute, shouldShowMobileBottomNav } from './layoutNavigation' import { useLayoutPermissions } from './useLayoutPermissions' import { useLayoutProfiles } from './useLayoutProfiles' import { useLayoutSidebar } from './useLayoutSidebar' import { useThemeMode } from './useThemeMode' function isMediaView(pathname: string, search: string): boolean { - const params = new URLSearchParams(search) - // 从设置/管理后台菜单进入(携带 from=admin 或 from=settings 或 manage=1)时展示左侧栏 - if (params.get('from') === 'admin' || params.get('from') === 'settings' || params.get('manage') === '1') { + // 从设置/管理后台菜单进入时展示左侧栏 + if (isAdminEntrySearch(search)) { return false } diff --git a/web/src/components/LayoutSections.tsx b/web/src/components/LayoutSections.tsx index 01b6bd3..f64d385 100644 --- a/web/src/components/LayoutSections.tsx +++ b/web/src/components/LayoutSections.tsx @@ -40,7 +40,7 @@ export function LayoutDesktopSidebar({ children, isSidebarOpen }: LayoutSidebarP return (