import { ApolloProvider } from "@apollo/client" ; import { useRouter } from "next/router" ; import { Fragment , PropsWithChildren } from "react" ; import { Layout } from "../components/Layout" ; import { clientSideClient } from "../services/ApolloClient" ; import { UserProvider } from "./UserProvider" ; import { SettingsProvider } from "../context/Theme" ; const EXCLUDE_LAYOUT = [ "/generative/[id]/enjoy" , "/u/[name]/collection/enjoy" , "/pkh/[id]/collection/enjoy" , ] ; export function Root ( { children } ) { const router = useRouter ( ) ; const LayoutWrapper = EXCLUDE_LAYOUT . includes ( router . pathname ) ? Fragment : Layout ; return ( < ApolloProvider client = { clientSideClient } > < SettingsProvider > < UserProvider > < LayoutWrapper > { children } < /LayoutWrapper> < /UserProvider> < /SettingsProvider> < /ApolloProvider>); }