Files
deer-flow/frontend/src/components/workspace/workspace-sidebar.tsx

68 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-01-20 16:00:39 +08:00
"use client";
2026-01-20 14:06:47 +08:00
import { SettingsIcon } from "lucide-react";
2026-01-20 23:43:21 +08:00
import { useState } from "react";
2026-01-20 14:06:47 +08:00
2026-01-15 23:40:21 +08:00
import {
Sidebar,
SidebarHeader,
SidebarContent,
SidebarFooter,
SidebarRail,
2026-01-20 14:06:47 +08:00
SidebarMenu,
SidebarMenuItem,
SidebarMenuButton,
SidebarGroup,
SidebarGroupContent,
2026-01-15 23:40:21 +08:00
} from "@/components/ui/sidebar";
2026-01-20 23:43:21 +08:00
import { SettingsDialog } from "@/components/workspace/settings";
2026-01-20 14:06:47 +08:00
import { useI18n } from "@/core/i18n/hooks";
2026-01-15 23:40:21 +08:00
import { RecentChatList } from "./recent-chat-list";
import { WorkspaceHeader } from "./workspace-header";
import { WorkspaceNavMenu } from "./workspace-nav-menu";
export function WorkspaceSidebar({
...props
}: React.ComponentProps<typeof Sidebar>) {
2026-01-20 14:06:47 +08:00
const { t } = useI18n();
2026-01-20 23:43:21 +08:00
const [settingsOpen, setSettingsOpen] = useState(false);
2026-01-15 23:40:21 +08:00
return (
2026-01-20 23:43:21 +08:00
<>
<Sidebar variant="sidebar" collapsible="icon" {...props}>
<SidebarHeader className="py-0">
<WorkspaceHeader />
</SidebarHeader>
<SidebarContent>
<WorkspaceNavMenu />
<RecentChatList />
</SidebarContent>
<SidebarFooter>
<SidebarGroup className="px-0">
<SidebarGroupContent>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<button
type="button"
className="text-muted-foreground flex w-full cursor-pointer items-center gap-2"
onClick={() => setSettingsOpen(true)}
>
<SettingsIcon size={16} />
<span>{t.common.settings}</span>
</button>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarFooter>
<SidebarRail />
</Sidebar>
<SettingsDialog open={settingsOpen} onOpenChange={setSettingsOpen} />
</>
2026-01-15 23:40:21 +08:00
);
}