layout.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* eslint-disable @next/next/no-page-custom-font */
  2. import "./styles/globals.scss";
  3. import "./styles/markdown.scss";
  4. import "./styles/highlight.scss";
  5. import { getClientConfig } from "./config/client";
  6. import { type Metadata } from "next";
  7. import { SpeedInsights } from "@vercel/speed-insights/next";
  8. import { getServerSideConfig } from "./config/server";
  9. import { GoogleTagManager } from "@next/third-parties/google";
  10. const serverConfig = getServerSideConfig();
  11. export const metadata: Metadata = {
  12. title: "NextChat",
  13. description: "Your personal ChatGPT Chat Bot.",
  14. viewport: {
  15. width: "device-width",
  16. initialScale: 1,
  17. maximumScale: 1,
  18. },
  19. themeColor: [
  20. { media: "(prefers-color-scheme: light)", color: "#fafafa" },
  21. { media: "(prefers-color-scheme: dark)", color: "#151515" },
  22. ],
  23. appleWebApp: {
  24. title: "NextChat",
  25. statusBarStyle: "default",
  26. },
  27. };
  28. export default function RootLayout({
  29. children,
  30. }: {
  31. children: React.ReactNode;
  32. }) {
  33. return (
  34. <html lang="en">
  35. <head>
  36. <meta name="config" content={JSON.stringify(getClientConfig())} />
  37. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  38. <link rel="manifest" href="/site.webmanifest"></link>
  39. <script src="/serviceWorkerRegister.js" defer></script>
  40. </head>
  41. <body>
  42. {children}
  43. {serverConfig?.isVercel && (
  44. <>
  45. <SpeedInsights />
  46. </>
  47. )}
  48. {serverConfig?.gtmId && (
  49. <>
  50. <GoogleTagManager gtmId={serverConfig.gtmId} />
  51. </>
  52. )}
  53. </body>
  54. </html>
  55. );
  56. }