mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-12 22:42:13 +02:00
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:
parent
2fa8b76b56
commit
33e685c6ed
2 changed files with 6 additions and 1 deletions
|
|
@ -352,6 +352,9 @@ export function LayoutShell({
|
||||||
onPlaygroundItemClick={
|
onPlaygroundItemClick={
|
||||||
playgroundSidebar ? handlePlaygroundSidebarToggle : undefined
|
playgroundSidebar ? handlePlaygroundSidebarToggle : undefined
|
||||||
}
|
}
|
||||||
|
isPlaygroundSidebarOpen={
|
||||||
|
playgroundSidebar ? !isPlaygroundSidebarCollapsed : undefined
|
||||||
|
}
|
||||||
chats={chats}
|
chats={chats}
|
||||||
activeChatId={activeChatId}
|
activeChatId={activeChatId}
|
||||||
onNewChat={onNewChat}
|
onNewChat={onNewChat}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ interface SidebarProps {
|
||||||
navItems: NavItem[];
|
navItems: NavItem[];
|
||||||
onNavItemClick?: (item: NavItem) => void;
|
onNavItemClick?: (item: NavItem) => void;
|
||||||
onPlaygroundItemClick?: (item: NavItem) => void;
|
onPlaygroundItemClick?: (item: NavItem) => void;
|
||||||
|
isPlaygroundSidebarOpen?: boolean;
|
||||||
chats: ChatItem[];
|
chats: ChatItem[];
|
||||||
activeChatId?: number | null;
|
activeChatId?: number | null;
|
||||||
onNewChat: () => void;
|
onNewChat: () => void;
|
||||||
|
|
@ -91,6 +92,7 @@ export function Sidebar({
|
||||||
navItems,
|
navItems,
|
||||||
onNavItemClick,
|
onNavItemClick,
|
||||||
onPlaygroundItemClick,
|
onPlaygroundItemClick,
|
||||||
|
isPlaygroundSidebarOpen,
|
||||||
chats,
|
chats,
|
||||||
activeChatId,
|
activeChatId,
|
||||||
onNewChat,
|
onNewChat,
|
||||||
|
|
@ -246,7 +248,7 @@ export function Sidebar({
|
||||||
label={playgroundItem.title}
|
label={playgroundItem.title}
|
||||||
onClick={() => (onPlaygroundItemClick ?? onNavItemClick)?.(playgroundItem)}
|
onClick={() => (onPlaygroundItemClick ?? onNavItemClick)?.(playgroundItem)}
|
||||||
isCollapsed={isCollapsed}
|
isCollapsed={isCollapsed}
|
||||||
isActive={playgroundItem.isActive}
|
isActive={isPlaygroundSidebarOpen ?? playgroundItem.isActive}
|
||||||
badge={<SidebarButtonBadge>New</SidebarButtonBadge>}
|
badge={<SidebarButtonBadge>New</SidebarButtonBadge>}
|
||||||
tooltipContent={isCollapsed ? playgroundItem.title : undefined}
|
tooltipContent={isCollapsed ? playgroundItem.title : undefined}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue