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目录位置
This commit is contained in:
HouYunFei
2026-05-21 14:52:33 +08:00
parent ef9e87fb29
commit dd6e426d78
10 changed files with 11 additions and 10 deletions
@@ -0,0 +1,25 @@
"use client";
import type { ReactNode } from "react";
import { useEffect } from "react";
import { usePathname } from "next/navigation";
import { useConfigStore } from "@/stores/use-config-store";
import { useUserStore } from "@/stores/use-user-store";
export function ClientRootInit({ children }: { children: ReactNode }) {
const pathname = usePathname();
const hydrateUser = useUserStore((state) => state.hydrateUser);
const loadPublicSettings = useConfigStore((state) => state.loadPublicSettings);
const isLoginPage = pathname === "/login" || pathname === "/admin/login";
useEffect(() => {
void loadPublicSettings();
}, [loadPublicSettings]);
useEffect(() => {
if (!isLoginPage) void hydrateUser();
}, [hydrateUser, isLoginPage]);
return <>{children}</>;
}