fix: hide chats when sidebar is not open

This commit is contained in:
Henry Li
2026-01-27 10:41:08 +08:00
parent cc1fe4e50e
commit ed31dc6aab

View File

@@ -6,6 +6,7 @@ import {
SidebarContent,
SidebarFooter,
SidebarRail,
useSidebar,
} from "@/components/ui/sidebar";
import { RecentChatList } from "./recent-chat-list";
@@ -16,6 +17,7 @@ import { WorkspaceNavMenu } from "./workspace-nav-menu";
export function WorkspaceSidebar({
...props
}: React.ComponentProps<typeof Sidebar>) {
const { open: isSidebarOpen } = useSidebar();
return (
<>
<Sidebar variant="sidebar" collapsible="icon" {...props}>
@@ -24,7 +26,7 @@ export function WorkspaceSidebar({
</SidebarHeader>
<SidebarContent>
<WorkspaceNavChatList />
<RecentChatList />
{isSidebarOpen && <RecentChatList />}
</SidebarContent>
<SidebarFooter>
<WorkspaceNavMenu />