44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import './globals.css'
|
|
import {ReactNode} from 'react'
|
|
import {Metadata} from 'next'
|
|
import {Toaster} from '@/components/ui/sonner'
|
|
import Effects from '@/app/effects'
|
|
import {ProfileStoreProvider} from '@/components/stores/profile'
|
|
import {LayoutStoreProvider} from '@/components/stores/layout'
|
|
import {ClientStoreProvider} from '@/components/stores/client'
|
|
import {getProfile} from '@/actions/auth'
|
|
import Script from 'next/script'
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
return {
|
|
title: '蓝狐代理',
|
|
}
|
|
}
|
|
|
|
export default async function RootLayout(props: Readonly<{
|
|
children: ReactNode
|
|
}>) {
|
|
return (
|
|
<html lang="zh-CN">
|
|
<body>
|
|
<StoreProviders>
|
|
<Effects>{props.children}</Effects>
|
|
</StoreProviders>
|
|
<Toaster position="top-center" richColors expand/>
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|
|
|
|
function StoreProviders(props: {children: ReactNode}) {
|
|
return (
|
|
<ProfileStoreProvider profile={getProfile().then(resp => resp.success ? resp.data : null)}>
|
|
<LayoutStoreProvider>
|
|
<ClientStoreProvider>
|
|
{props.children}
|
|
</ClientStoreProvider>
|
|
</LayoutStoreProvider>
|
|
</ProfileStoreProvider>
|
|
)
|
|
}
|