2026-01-15 23:40:21 +08:00
|
|
|
"use client";
|
|
|
|
|
|
2026-01-22 14:19:54 +08:00
|
|
|
import {
|
|
|
|
|
BugIcon,
|
|
|
|
|
ChevronsUpDown,
|
2026-01-24 18:21:50 +08:00
|
|
|
GlobeIcon,
|
2026-01-22 14:19:54 +08:00
|
|
|
InfoIcon,
|
|
|
|
|
MailIcon,
|
|
|
|
|
Settings2Icon,
|
|
|
|
|
SettingsIcon,
|
|
|
|
|
} from "lucide-react";
|
2026-02-07 11:10:24 +08:00
|
|
|
import { useEffect, useState } from "react";
|
2026-01-15 23:40:21 +08:00
|
|
|
|
|
|
|
|
import {
|
2026-01-22 14:19:54 +08:00
|
|
|
DropdownMenu,
|
|
|
|
|
DropdownMenuContent,
|
|
|
|
|
DropdownMenuGroup,
|
|
|
|
|
DropdownMenuItem,
|
|
|
|
|
DropdownMenuSeparator,
|
|
|
|
|
DropdownMenuTrigger,
|
|
|
|
|
} from "@/components/ui/dropdown-menu";
|
|
|
|
|
import {
|
2026-01-15 23:40:21 +08:00
|
|
|
SidebarMenu,
|
|
|
|
|
SidebarMenuButton,
|
|
|
|
|
SidebarMenuItem,
|
2026-01-22 15:18:42 +08:00
|
|
|
useSidebar,
|
2026-01-15 23:40:21 +08:00
|
|
|
} from "@/components/ui/sidebar";
|
2026-01-20 14:06:47 +08:00
|
|
|
import { useI18n } from "@/core/i18n/hooks";
|
2026-01-15 23:40:21 +08:00
|
|
|
|
2026-01-22 14:19:54 +08:00
|
|
|
import { GithubIcon } from "./github-icon";
|
|
|
|
|
import { SettingsDialog } from "./settings";
|
|
|
|
|
|
2026-02-07 11:10:24 +08:00
|
|
|
function NavMenuButtonContent({
|
|
|
|
|
isSidebarOpen,
|
|
|
|
|
t,
|
|
|
|
|
}: {
|
|
|
|
|
isSidebarOpen: boolean;
|
|
|
|
|
t: ReturnType<typeof useI18n>["t"];
|
|
|
|
|
}) {
|
|
|
|
|
return isSidebarOpen ? (
|
|
|
|
|
<div className="text-muted-foreground flex w-full items-center gap-2 text-left text-sm">
|
|
|
|
|
<SettingsIcon className="size-4" />
|
|
|
|
|
<span>{t.workspace.settingsAndMore}</span>
|
|
|
|
|
<ChevronsUpDown className="text-muted-foreground ml-auto size-4" />
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="flex size-full items-center justify-center">
|
|
|
|
|
<SettingsIcon className="text-muted-foreground size-4" />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-15 23:40:21 +08:00
|
|
|
export function WorkspaceNavMenu() {
|
2026-01-22 14:19:54 +08:00
|
|
|
const [settingsOpen, setSettingsOpen] = useState(false);
|
2026-02-06 15:18:37 +08:00
|
|
|
const [settingsDefaultSection, setSettingsDefaultSection] = useState<
|
|
|
|
|
"appearance" | "memory" | "tools" | "skills" | "notification" | "about"
|
|
|
|
|
>("appearance");
|
2026-02-07 11:10:24 +08:00
|
|
|
const [mounted, setMounted] = useState(false);
|
2026-01-22 15:18:42 +08:00
|
|
|
const { open: isSidebarOpen } = useSidebar();
|
2026-01-20 14:06:47 +08:00
|
|
|
const { t } = useI18n();
|
2026-02-07 11:10:24 +08:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setMounted(true);
|
|
|
|
|
}, []);
|
|
|
|
|
|
2026-01-15 23:40:21 +08:00
|
|
|
return (
|
2026-01-22 14:19:54 +08:00
|
|
|
<>
|
2026-02-06 15:18:37 +08:00
|
|
|
<SettingsDialog
|
|
|
|
|
open={settingsOpen}
|
|
|
|
|
onOpenChange={setSettingsOpen}
|
|
|
|
|
defaultSection={settingsDefaultSection}
|
|
|
|
|
/>
|
2026-01-22 14:19:54 +08:00
|
|
|
<SidebarMenu className="w-full">
|
2026-01-15 23:40:21 +08:00
|
|
|
<SidebarMenuItem>
|
2026-02-07 11:10:24 +08:00
|
|
|
{mounted ? (
|
|
|
|
|
<DropdownMenu>
|
|
|
|
|
<DropdownMenuTrigger asChild>
|
|
|
|
|
<SidebarMenuButton
|
|
|
|
|
size="lg"
|
|
|
|
|
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
|
|
|
|
|
>
|
|
|
|
|
<NavMenuButtonContent isSidebarOpen={isSidebarOpen} t={t} />
|
|
|
|
|
</SidebarMenuButton>
|
|
|
|
|
</DropdownMenuTrigger>
|
|
|
|
|
<DropdownMenuContent
|
|
|
|
|
className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
|
|
|
|
|
align="end"
|
|
|
|
|
sideOffset={4}
|
2026-01-22 14:19:54 +08:00
|
|
|
>
|
2026-02-07 11:10:24 +08:00
|
|
|
<DropdownMenuGroup>
|
|
|
|
|
<DropdownMenuItem
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setSettingsDefaultSection("appearance");
|
|
|
|
|
setSettingsOpen(true);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Settings2Icon />
|
|
|
|
|
{t.common.settings}
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
<DropdownMenuSeparator />
|
|
|
|
|
<a
|
|
|
|
|
href="https://deerflow.tech/"
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
>
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<GlobeIcon />
|
|
|
|
|
{t.workspace.officialWebsite}
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
</a>
|
|
|
|
|
<a
|
|
|
|
|
href="https://github.com/bytedance/deer-flow"
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
>
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<GithubIcon />
|
|
|
|
|
{t.workspace.visitGithub}
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
</a>
|
|
|
|
|
<DropdownMenuSeparator />
|
|
|
|
|
<a
|
|
|
|
|
href="https://github.com/bytedance/deer-flow/issues"
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
>
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<BugIcon />
|
|
|
|
|
{t.workspace.reportIssue}
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
</a>
|
|
|
|
|
<a href="mailto:support@deerflow.tech">
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<MailIcon />
|
|
|
|
|
{t.workspace.contactUs}
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
</a>
|
|
|
|
|
</DropdownMenuGroup>
|
|
|
|
|
<DropdownMenuSeparator />
|
2026-02-06 15:18:37 +08:00
|
|
|
<DropdownMenuItem
|
|
|
|
|
onClick={() => {
|
2026-02-07 11:10:24 +08:00
|
|
|
setSettingsDefaultSection("about");
|
2026-02-06 15:18:37 +08:00
|
|
|
setSettingsOpen(true);
|
|
|
|
|
}}
|
|
|
|
|
>
|
2026-02-07 11:10:24 +08:00
|
|
|
<InfoIcon />
|
|
|
|
|
{t.workspace.about}
|
2026-01-22 14:19:54 +08:00
|
|
|
</DropdownMenuItem>
|
2026-02-07 11:10:24 +08:00
|
|
|
</DropdownMenuContent>
|
|
|
|
|
</DropdownMenu>
|
|
|
|
|
) : (
|
|
|
|
|
<SidebarMenuButton size="lg" className="pointer-events-none">
|
|
|
|
|
<NavMenuButtonContent isSidebarOpen={isSidebarOpen} t={t} />
|
|
|
|
|
</SidebarMenuButton>
|
|
|
|
|
)}
|
2026-01-15 23:40:21 +08:00
|
|
|
</SidebarMenuItem>
|
|
|
|
|
</SidebarMenu>
|
2026-01-22 14:19:54 +08:00
|
|
|
</>
|
2026-01-15 23:40:21 +08:00
|
|
|
);
|
|
|
|
|
}
|