diff --git a/src/app/layout.tsx b/src/app/layout.tsx index b231863..1e751db 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,7 @@ import type { Metadata } from "next"; -import "./globals.css"; + +import "~/app/globals.css"; +import { Providers } from "~/app/providers"; export const metadata: Metadata = { title: "Farcaster Frames v2 Demo", @@ -13,7 +15,9 @@ export default function RootLayout({ }>) { return ( - {children} + + {children} + ); } diff --git a/src/app/page.tsx b/src/app/page.tsx index 7ae4fa1..2ef4cc3 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,9 +1,15 @@ -import { App } from "~/components/App"; +"use client"; + +import dynamic from "next/dynamic"; + +const Demo = dynamic(() => import("~/components/Demo"), { + ssr: false, +}); export default function Home() { return (
- +
); } diff --git a/src/app/providers.tsx b/src/app/providers.tsx new file mode 100644 index 0000000..1482640 --- /dev/null +++ b/src/app/providers.tsx @@ -0,0 +1,14 @@ +"use client"; + +import dynamic from "next/dynamic"; + +const WagmiProvider = dynamic( + () => import("~/components/providers/WagmiProvider"), + { + ssr: false, + } +); + +export function Providers({ children }: { children: React.ReactNode }) { + return {children}; +} diff --git a/src/components/App.tsx b/src/components/App.tsx deleted file mode 100644 index 7df57c1..0000000 --- a/src/components/App.tsx +++ /dev/null @@ -1,19 +0,0 @@ -"use client"; - -import dynamic from "next/dynamic"; - -const Demo = dynamic(() => import("./Demo"), { - ssr: false, -}); - -const WagmiConfig = dynamic(() => import("./WagmiProvider"), { - ssr: false, -}); - -export function App() { - return ( - - - - ); -} diff --git a/src/components/Demo.tsx b/src/components/Demo.tsx index cc71739..6462e7e 100644 --- a/src/components/Demo.tsx +++ b/src/components/Demo.tsx @@ -10,7 +10,7 @@ import { useConnect, } from "wagmi"; -import { config } from "~/components/WagmiProvider"; +import { config } from "~/components/providers/WagmiProvider"; import { Button } from "~/components/ui/Button"; import { truncateAddress } from "~/lib/truncateAddress"; diff --git a/src/components/WagmiProvider.tsx b/src/components/providers/WagmiProvider.tsx similarity index 85% rename from src/components/WagmiProvider.tsx rename to src/components/providers/WagmiProvider.tsx index c75b297..3ef6359 100644 --- a/src/components/WagmiProvider.tsx +++ b/src/components/providers/WagmiProvider.tsx @@ -1,3 +1,5 @@ +"use client"; + import { createConfig, http, WagmiProvider } from "wagmi"; import { base } from "wagmi/chains"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; @@ -13,7 +15,7 @@ export const config = createConfig({ const queryClient = new QueryClient(); -export default function WagmiConfig({ children }: { children: React.ReactNode }) { +export default function Provider({ children }: { children: React.ReactNode }) { return ( {children}