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 })) }