layout.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. <link rel="manifest" href="/site.webmanifest"></link>
  38. <script src="/serviceWorkerRegister.js" defer></script>
  39. </head>
  40. <body>
  41. {children}
  42. {serverConfig?.isVercel && (
  43. <>
  44. <SpeedInsights />
  45. </>
  46. )}
  47. {serverConfig?.gtmId && (
  48. <>
  49. <GoogleTagManager gtmId={serverConfig.gtmId} />
  50. </>
  51. )}
  52. </body>
  53. </html>
  54. );
  55. }