layout.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import type { Viewport } from 'next'
  2. import I18nServer from './components/i18n-server'
  3. import BrowserInitor from './components/browser-initor'
  4. import SentryInitor from './components/sentry-initor'
  5. import { getLocaleOnServer } from '@/i18n/server'
  6. import './styles/globals.css'
  7. import './styles/markdown.scss'
  8. export const metadata = {
  9. title: '智脑云平台',
  10. }
  11. export const viewport: Viewport = {
  12. width: 'device-width',
  13. initialScale: 1,
  14. maximumScale: 1,
  15. viewportFit: 'cover',
  16. userScalable: false,
  17. }
  18. const LocaleLayout = ({
  19. children,
  20. }: {
  21. children: React.ReactNode
  22. }) => {
  23. const locale = getLocaleOnServer()
  24. return (
  25. <html lang={locale ?? 'en'} className="h-full" data-theme="light">
  26. <head>
  27. <meta name="theme-color" content="#FFFFFF" />
  28. <meta name="mobile-web-app-capable" content="yes" />
  29. <meta name="apple-mobile-web-app-capable" content="yes" />
  30. <meta name="apple-mobile-web-app-status-bar-style" content="default" />
  31. </head>
  32. <body
  33. className="h-full select-auto"
  34. data-api-prefix={process.env.NEXT_PUBLIC_API_PREFIX}
  35. data-pubic-api-prefix={process.env.NEXT_PUBLIC_PUBLIC_API_PREFIX}
  36. data-public-edition={process.env.NEXT_PUBLIC_EDITION}
  37. data-public-support-mail-login={process.env.NEXT_PUBLIC_SUPPORT_MAIL_LOGIN}
  38. data-public-sentry-dsn={process.env.NEXT_PUBLIC_SENTRY_DSN}
  39. data-public-maintenance-notice={process.env.NEXT_PUBLIC_MAINTENANCE_NOTICE}
  40. data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
  41. data-public-text-generation-timeout-ms={process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS}
  42. >
  43. <BrowserInitor>
  44. <SentryInitor>
  45. <I18nServer>{children}</I18nServer>
  46. </SentryInitor>
  47. </BrowserInitor>
  48. </body>
  49. </html>
  50. )
  51. }
  52. export default LocaleLayout