Files
web/src/app/layout.tsx

42 lines
946 B
TypeScript
Raw Normal View History

'use server'
2025-03-11 14:57:23 +08:00
import {ReactNode} from 'react'
import {Metadata} from 'next'
import './globals.css'
import localFont from 'next/font/local'
2025-03-19 15:49:18 +08:00
import {Toaster} from '@/components/ui/sonner'
2025-06-18 17:57:12 +08:00
import Stores from '@/app/stores'
import {getProfile} from '@/actions/auth'
2025-06-18 17:57:12 +08:00
import Effects from '@/app/effects'
2025-03-19 15:49:18 +08:00
const font = localFont({
src: './NotoSansSC-VariableFont_wght.ttf',
})
2025-03-04 10:10:35 +08:00
export async function generateMetadata(): Promise<Metadata> {
return {
title: '蓝狐代理',
}
2025-03-11 14:57:23 +08:00
}
2025-03-04 10:10:35 +08:00
export default async function RootLayout({
2025-03-04 10:10:35 +08:00
children,
}: Readonly<{
children: ReactNode
2025-03-04 10:10:35 +08:00
}>) {
const result = await getProfile()
const user = result.success ? result.data : null
2025-03-04 10:10:35 +08:00
return (
<html lang="zh-CN">
2025-03-24 11:45:54 +08:00
<body className={`${font.className}`}>
2025-06-18 17:57:12 +08:00
<Stores user={user}>
<Effects>
{children}
</Effects>
</Stores>
<Toaster position="top-center" richColors expand/>
2025-03-04 10:10:35 +08:00
</body>
</html>
2025-03-11 14:57:23 +08:00
)
2025-03-04 10:10:35 +08:00
}