refact common layout (#490)

This commit is contained in:
zxhlyh
2023-06-29 15:30:12 +08:00
committed by GitHub
parent da04ff040b
commit 39ea967b30
8 changed files with 150 additions and 153 deletions

View File

@@ -1,4 +1,5 @@
import I18nServer from './components/i18n-server'
import SentryInitor from './components/sentry-initor'
import { getLocaleOnServer } from '@/i18n/server'
import './styles/globals.css'
@@ -14,6 +15,7 @@ const LocaleLayout = ({
children: React.ReactNode
}) => {
const locale = getLocaleOnServer()
return (
<html lang={locale ?? 'en'} className="h-full">
<body
@@ -23,8 +25,10 @@ const LocaleLayout = ({
data-public-edition={process.env.NEXT_PUBLIC_EDITION}
data-public-sentry-dsn={process.env.NEXT_PUBLIC_SENTRY_DSN}
>
{/* @ts-expect-error Async Server Component */}
<I18nServer locale={locale}>{children}</I18nServer>
<SentryInitor>
{/* @ts-expect-error Async Server Component */}
<I18nServer locale={locale}>{children}</I18nServer>
</SentryInitor>
</body>
</html>
)