layout.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import I18nServer from './components/i18n-server'
  2. import BrowerInitor from './components/browser-initor'
  3. import SentryInitor from './components/sentry-initor'
  4. import { getLocaleOnServer } from '@/i18n/server'
  5. import './styles/globals.css'
  6. import './styles/markdown.scss'
  7. export const metadata = {
  8. title: 'Dify',
  9. viewport: 'width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover, user-scalable=no',
  10. }
  11. const LocaleLayout = ({
  12. children,
  13. }: {
  14. children: React.ReactNode
  15. }) => {
  16. const locale = getLocaleOnServer()
  17. return (
  18. <html lang={locale ?? 'en'} className="h-full">
  19. <head>
  20. <meta name="theme-color" content="#FFFFFF" />
  21. <meta name="mobile-web-app-capable" content="yes" />
  22. <meta name="apple-mobile-web-app-capable" content="yes" />
  23. <meta name="apple-mobile-web-app-status-bar-style" content="default" />
  24. </head>
  25. <body
  26. className="h-full select-auto"
  27. data-api-prefix={process.env.NEXT_PUBLIC_API_PREFIX}
  28. data-pubic-api-prefix={process.env.NEXT_PUBLIC_PUBLIC_API_PREFIX}
  29. data-public-edition={process.env.NEXT_PUBLIC_EDITION}
  30. data-public-sentry-dsn={process.env.NEXT_PUBLIC_SENTRY_DSN}
  31. data-public-maintenance-notice={process.env.NEXT_PUBLIC_MAINTENANCE_NOTICE}
  32. data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
  33. >
  34. <BrowerInitor>
  35. <SentryInitor>
  36. {/* @ts-expect-error Async Server Component */}
  37. <I18nServer locale={locale}>{children}</I18nServer>
  38. </SentryInitor>
  39. </BrowerInitor>
  40. </body>
  41. </html>
  42. )
  43. }
  44. export default LocaleLayout