From d98cae124f6cac4f809c745c6357206ab1f0f1d6 Mon Sep 17 00:00:00 2001 From: webdevcody Date: Fri, 16 Jan 2026 22:27:19 -0500 Subject: [PATCH] feat: enhance sidebar functionality for mobile and compact views - Introduced a floating toggle button for mobile to show/hide the sidebar when collapsed. - Updated sidebar behavior to completely hide on mobile when the new mobileSidebarHidden state is true. - Added logic to conditionally render sidebar components based on screen size using the new useIsCompact hook. - Enhanced SidebarHeader to include close and expand buttons for mobile views. - Refactored CollapseToggleButton to hide in compact mode. - Implemented HeaderActionsPanel for mobile actions in various views, improving accessibility and usability on smaller screens. These changes improve the user experience on mobile devices by providing better navigation options and visibility controls. --- apps/ui/src/components/layout/sidebar.tsx | 47 +++- .../components/collapse-toggle-button.tsx | 8 + .../layout/sidebar/components/index.ts | 1 + .../components/mobile-sidebar-toggle.tsx | 42 ++++ .../sidebar/components/sidebar-header.tsx | 174 ++++++++++--- .../sidebar/components/sidebar-navigation.tsx | 7 +- .../components/ui/header-actions-panel.tsx | 105 ++++++++ .../agent-view/components/agent-header.tsx | 25 +- .../views/board-view/board-header.tsx | 25 +- .../views/board-view/header-mobile-menu.tsx | 228 +++++++++--------- apps/ui/src/components/views/context-view.tsx | 89 +++++-- .../src/components/views/dashboard-view.tsx | 172 ++++++++++--- apps/ui/src/components/views/memory-view.tsx | 82 +++++-- .../project-settings-navigation.tsx | 8 +- .../project-settings-view.tsx | 22 +- .../components/settings-header.tsx | 58 +++-- .../components/settings-navigation.tsx | 8 +- apps/ui/src/components/views/spec-view.tsx | 6 + .../spec-view/components/spec-header.tsx | 194 ++++++++++----- apps/ui/src/hooks/use-media-query.ts | 9 + apps/ui/src/routes/__root.tsx | 18 +- apps/ui/src/store/app-store.ts | 6 + apps/ui/src/styles/global.css | 10 + 23 files changed, 982 insertions(+), 362 deletions(-) create mode 100644 apps/ui/src/components/layout/sidebar/components/mobile-sidebar-toggle.tsx create mode 100644 apps/ui/src/components/ui/header-actions-panel.tsx diff --git a/apps/ui/src/components/layout/sidebar.tsx b/apps/ui/src/components/layout/sidebar.tsx index 6cdb32cd..0baa81cf 100644 --- a/apps/ui/src/components/layout/sidebar.tsx +++ b/apps/ui/src/components/layout/sidebar.tsx @@ -20,7 +20,10 @@ import { SidebarHeader, SidebarNavigation, SidebarFooter, + MobileSidebarToggle, } from './sidebar/components'; +import { useIsCompact } from '@/hooks/use-media-query'; +import { PanelLeftClose } from 'lucide-react'; import { TrashDialog, OnboardingDialog } from './sidebar/dialogs'; import { SIDEBAR_FEATURE_FLAGS } from './sidebar/constants'; import { @@ -44,9 +47,11 @@ export function Sidebar() { trashedProjects, currentProject, sidebarOpen, + mobileSidebarHidden, projectHistory, upsertAndSetCurrentProject, toggleSidebar, + toggleMobileSidebarHidden, restoreTrashedProject, deleteTrashedProject, emptyTrash, @@ -57,6 +62,8 @@ export function Sidebar() { setSpecCreatingForProject, } = useAppStore(); + const isCompact = useIsCompact(); + // Environment variable flags for hiding sidebar items const { hideTerminal, hideRunningAgents, hideContext, hideSpecEditor } = SIDEBAR_FEATURE_FLAGS; @@ -255,10 +262,16 @@ export function Sidebar() { return location.pathname === routePath; }; + // Check if sidebar should be completely hidden on mobile + const shouldHideSidebar = isCompact && mobileSidebarHidden; + return ( <> + {/* Floating toggle to show sidebar on mobile when hidden */} + + {/* Mobile backdrop overlay */} - {sidebarOpen && ( + {sidebarOpen && !shouldHideSidebar && (