feat: auto-close sidebar on mobile when navigating to content

- Add effect to close sidebar when route changes on mobile
- Handles clicking on blog posts in Explore view
- Complements existing sidebar auto-close for bookmarks and highlights
- Improves mobile UX by preventing sidebar from blocking content
This commit is contained in:
Gigi
2025-10-11 01:37:46 +01:00
parent 5a67be8096
commit 72a264a01e
2 changed files with 11 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
---
alwaysApply: true
---

View File

@@ -90,6 +90,14 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
setHighlightVisibility
} = useBookmarksUI({ settings })
// Close sidebar on mobile when route changes (e.g., clicking on blog posts in Explore)
useEffect(() => {
if (isMobile && isSidebarOpen) {
toggleSidebar()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [location.pathname])
const {
bookmarks,
bookmarksLoading,