Files
infinite-canvas/web/src/app/(user)/layout.tsx
T
HouYunFei dd6e426d78 refactor(layout): 组件文件迁移至layout目录
- 将AppProviders组件从src/components迁移到src/components/layout
- 将AppTopNav组件从src/components迁移到src/components/layout
- 将UserStatusActions组件从src/components迁移到src/components/layout
- 将ClientRootInit组件从src/components迁移到src/components/layout
- 将GitHubLink组件从src/components迁移到src/components/layout
- 将VersionReleaseModal组件从src/components迁移到src/components/layout
- 更新所有相关组件导入路径引用新的layout目录位置
2026-05-21 14:52:33 +08:00

24 lines
1.0 KiB
TypeScript

"use client";
import type { ReactNode } from "react";
import { usePathname } from "next/navigation";
import { AppTopNav } from "@/components/layout/app-top-nav";
import { type NavigationToolSlug, navigationTools } from "@/lib/navigation-tools";
import { useConfigStore } from "@/stores/use-config-store";
export default function UserLayout({ children }: { children: ReactNode }) {
const pathname = usePathname();
const config = useConfigStore((state) => state.config);
const updateConfig = useConfigStore((state) => state.updateConfig);
const slug = pathname.split("/").filter(Boolean)[0];
const activeToolSlug = navigationTools.some((tool) => tool.slug === slug) ? (slug as NavigationToolSlug) : undefined;
return (
<div className="flex h-dvh flex-col overflow-hidden bg-background text-foreground">
<AppTopNav activeToolSlug={activeToolSlug} config={config} onConfigChange={updateConfig} hideHeader={/^\/canvas\/[^/]+/.test(pathname)} />
<div className="min-h-0 flex-1 overflow-hidden">{children}</div>
</div>
);
}