layout.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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, Viewport } from "next";
  7. import { SpeedInsights } from "@vercel/speed-insights/next";
  8. import { GoogleTagManager, GoogleAnalytics } from "@next/third-parties/google";
  9. import { getServerSideConfig } from "./config/server";
  10. export const metadata: Metadata = {
  11. title: "NextChat",
  12. description: "Your personal ChatGPT Chat Bot.",
  13. appleWebApp: {
  14. title: "NextChat",
  15. statusBarStyle: "default",
  16. },
  17. };
  18. export const viewport: Viewport = {
  19. width: "device-width",
  20. initialScale: 1,
  21. maximumScale: 1,
  22. themeColor: [
  23. { media: "(prefers-color-scheme: light)", color: "#fafafa" },
  24. { media: "(prefers-color-scheme: dark)", color: "#151515" },
  25. ],
  26. };
  27. export default function RootLayout({
  28. children,
  29. }: {
  30. children: React.ReactNode;
  31. }) {
  32. const serverConfig = getServerSideConfig();
  33. return (
  34. <html lang="en">
  35. <head>
  36. <meta name="config" content={JSON.stringify(getClientConfig())} />
  37. <meta
  38. name="viewport"
  39. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
  40. />
  41. <link
  42. rel="manifest"
  43. href="/site.webmanifest"
  44. crossOrigin="use-credentials"
  45. ></link>
  46. <script src="/serviceWorkerRegister.js" defer></script>
  47. </head>
  48. <body>
  49. {children}
  50. {serverConfig?.isVercel && (
  51. <>
  52. <SpeedInsights />
  53. </>
  54. )}
  55. {serverConfig?.gtmId && (
  56. <>
  57. <GoogleTagManager gtmId={serverConfig.gtmId} />
  58. </>
  59. )}
  60. {serverConfig?.gaId && (
  61. <>
  62. <GoogleAnalytics gaId={serverConfig.gaId} />
  63. </>
  64. )}
  65. </body>
  66. </html>
  67. );
  68. }