From 6793bc40b6069fd60b4b2b6331a863e917d71c04 Mon Sep 17 00:00:00 2001 From: gallery Date: Sun, 15 Nov 2026 20:35:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=20pin=20=E4=BD=8F=EF=BC=9B=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=8F=90=E7=A4=BA=E6=B5=AE=E4=BA=8E=E6=9C=80?= =?UTF-8?q?=E4=B8=8A=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/header/Header.tsx | 2 +- ui/src/components/messages/Messages.tsx | 2 ++ ui/src/components/sidebar/Sidebar.tsx | 14 +++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ui/src/components/header/Header.tsx b/ui/src/components/header/Header.tsx index e10cb01..699d58f 100644 --- a/ui/src/components/header/Header.tsx +++ b/ui/src/components/header/Header.tsx @@ -12,7 +12,7 @@ const Header = () => {

diff --git a/ui/src/components/messages/Messages.tsx b/ui/src/components/messages/Messages.tsx index d4827e3..fb97689 100644 --- a/ui/src/components/messages/Messages.tsx +++ b/ui/src/components/messages/Messages.tsx @@ -11,6 +11,8 @@ const Container = styled.div` bottom: 20px; right: 20px; width: 500px; + /* Keep notifications above the sidebar (z-40) and modals (z-40) */ + z-index: 50; @media (max-width: 1000px) { display: none; diff --git a/ui/src/components/sidebar/Sidebar.tsx b/ui/src/components/sidebar/Sidebar.tsx index 3af4a36..4e052a6 100644 --- a/ui/src/components/sidebar/Sidebar.tsx +++ b/ui/src/components/sidebar/Sidebar.tsx @@ -41,9 +41,21 @@ export const SidebarProvider = ({ children }: SidebarProviderProps) => { pinned: false, }) + const defaultPinned = () => + typeof window !== 'undefined' && + typeof window.matchMedia === 'function' + ? window.matchMedia('(min-width: 1024px)').matches + : false + const updateSidebar = (content: React.ReactNode | null) => { if (content) { - setState(state => ({ ...state, content })) + setState(state => ({ + ...state, + content, + // Pin the sidebar by default when it is opened on a large screen, but + // keep the user's choice if the sidebar is already open. + pinned: state.content == null ? defaultPinned() : state.pinned, + })) } else { setState(state => ({ ...state, content: null, pinned: false })) }