From 33e685c6ed456cd79896734cf4b13b4120fb41eb Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 8 Jul 2026 10:08:37 +0530 Subject: [PATCH] feat(sidebar): add isPlaygroundSidebarOpen prop for improved sidebar state management - Introduced isPlaygroundSidebarOpen prop to Sidebar component for better control of sidebar visibility. - Updated LayoutShell to manage playground sidebar state, enhancing user experience and navigation consistency. --- surfsense_web/components/layout/ui/shell/LayoutShell.tsx | 3 +++ surfsense_web/components/layout/ui/sidebar/Sidebar.tsx | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx index 138e1c74b..c9bbe8efc 100644 --- a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx +++ b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx @@ -352,6 +352,9 @@ export function LayoutShell({ onPlaygroundItemClick={ playgroundSidebar ? handlePlaygroundSidebarToggle : undefined } + isPlaygroundSidebarOpen={ + playgroundSidebar ? !isPlaygroundSidebarCollapsed : undefined + } chats={chats} activeChatId={activeChatId} onNewChat={onNewChat} diff --git a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx index 4f867aa72..7862ae90e 100644 --- a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx @@ -53,6 +53,7 @@ interface SidebarProps { navItems: NavItem[]; onNavItemClick?: (item: NavItem) => void; onPlaygroundItemClick?: (item: NavItem) => void; + isPlaygroundSidebarOpen?: boolean; chats: ChatItem[]; activeChatId?: number | null; onNewChat: () => void; @@ -91,6 +92,7 @@ export function Sidebar({ navItems, onNavItemClick, onPlaygroundItemClick, + isPlaygroundSidebarOpen, chats, activeChatId, onNewChat, @@ -246,7 +248,7 @@ export function Sidebar({ label={playgroundItem.title} onClick={() => (onPlaygroundItemClick ?? onNavItemClick)?.(playgroundItem)} isCollapsed={isCollapsed} - isActive={playgroundItem.isActive} + isActive={isPlaygroundSidebarOpen ?? playgroundItem.isActive} badge={New} tooltipContent={isCollapsed ? playgroundItem.title : undefined} />