diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f346f7dc..632db85a 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,6 +1,7 @@ import { dir } from "i18next" import { Metadata } from "next" import { headers } from "next/headers" +import Script from "next/script" import { Toaster } from "react-hot-toast" import "@crossbell/connect-kit/colors.css" @@ -8,9 +9,17 @@ import { updateIndexerFetchOptions } from "@crossbell/indexer" import "~/css/main.css" import { getAcceptLang } from "~/lib/accept-lang" -import { APP_DESCRIPTION, APP_NAME, APP_SLOGAN, SITE_URL } from "~/lib/env" +import { + APP_DESCRIPTION, + APP_NAME, + APP_SLOGAN, + SITE_URL, + UMAMI_ID, + UMAMI_SCRIPT, +} from "~/lib/env" import { getColorScheme } from "~/lib/get-color-scheme" +import { ColorSchemeInjector } from "./ColorSchemeInjector" import Providers from "./providers" export const metadata: Metadata = { @@ -102,20 +111,22 @@ export default function RootLayout({ return ( - {/* */} + + + {modal} {children} - {/* */} + > ) diff --git a/src/app/providers.tsx b/src/app/providers.tsx index bd4381be..fa8d5e5e 100644 --- a/src/app/providers.tsx +++ b/src/app/providers.tsx @@ -1,6 +1,6 @@ "use client" -import { ThemeProvider } from "next-themes" +import dynamic from "next/dynamic" import { useState } from "react" import { WagmiConfig } from "wagmi" @@ -23,6 +23,12 @@ import { toGateway } from "~/lib/ipfs-parser" import { urlComposer } from "~/lib/url-composer" import { LangProvider } from "~/providers/LangProvider" +// https://github.com/vercel/next.js/discussions/22388#discussioncomment-6329930 +const ThemeProvider = dynamic( + () => import("~/components/common/ThemeProvider"), + { ssr: false }, +) + const wagmiConfig = createWagmiConfig({ appName: APP_NAME, // You can create or find it at https://cloud.walletconnect.com diff --git a/src/components/common/ThemeProvider.tsx b/src/components/common/ThemeProvider.tsx new file mode 100644 index 00000000..adab22a9 --- /dev/null +++ b/src/components/common/ThemeProvider.tsx @@ -0,0 +1,3 @@ +import { ThemeProvider } from "next-themes" + +export default ThemeProvider