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.
This commit is contained in:
Anish Sarkar 2026-07-08 10:08:37 +05:30
parent 2fa8b76b56
commit 33e685c6ed
2 changed files with 6 additions and 1 deletions

View file

@ -352,6 +352,9 @@ export function LayoutShell({
onPlaygroundItemClick={
playgroundSidebar ? handlePlaygroundSidebarToggle : undefined
}
isPlaygroundSidebarOpen={
playgroundSidebar ? !isPlaygroundSidebarCollapsed : undefined
}
chats={chats}
activeChatId={activeChatId}
onNewChat={onNewChat}

View file

@ -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={<SidebarButtonBadge>New</SidebarButtonBadge>}
tooltipContent={isCollapsed ? playgroundItem.title : undefined}
/>