mirror of
https://github.com/basketikun/infinite-canvas.git
synced 2026-08-05 00:34:22 +08:00
dd6e426d78
- 将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目录位置
24 lines
1.0 KiB
TypeScript
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>
|
|
);
|
|
}
|