mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-28 16:24:47 +08:00
fix: fix menu item in side bar collapsed mode
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
|||||||
SidebarMenu,
|
SidebarMenu,
|
||||||
SidebarMenuButton,
|
SidebarMenuButton,
|
||||||
SidebarMenuItem,
|
SidebarMenuItem,
|
||||||
|
useSidebar,
|
||||||
} from "@/components/ui/sidebar";
|
} from "@/components/ui/sidebar";
|
||||||
import { useI18n } from "@/core/i18n/hooks";
|
import { useI18n } from "@/core/i18n/hooks";
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ import { SettingsDialog } from "./settings";
|
|||||||
|
|
||||||
export function WorkspaceNavMenu() {
|
export function WorkspaceNavMenu() {
|
||||||
const [settingsOpen, setSettingsOpen] = useState(false);
|
const [settingsOpen, setSettingsOpen] = useState(false);
|
||||||
|
const { open: isSidebarOpen } = useSidebar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -42,13 +44,17 @@ export function WorkspaceNavMenu() {
|
|||||||
size="lg"
|
size="lg"
|
||||||
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
|
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
|
||||||
>
|
>
|
||||||
<div className="flex w-full items-center gap-2">
|
{isSidebarOpen ? (
|
||||||
<div className="text-muted-foreground flex items-center gap-2 text-left text-sm leading-tight">
|
<div className="text-muted-foreground flex w-full items-center gap-2 text-left text-sm">
|
||||||
<SettingsIcon className="size-4" />
|
<SettingsIcon className="size-4" />
|
||||||
{t.workspace.settingsAndMore}
|
<span>{t.workspace.settingsAndMore}</span>
|
||||||
|
<ChevronsUpDown className="text-muted-foreground ml-auto size-4" />
|
||||||
</div>
|
</div>
|
||||||
<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>
|
||||||
|
)}
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent
|
<DropdownMenuContent
|
||||||
|
|||||||
Reference in New Issue
Block a user