diff --git a/src/app/app.tsx b/src/app/app.tsx new file mode 100644 index 0000000..09927df --- /dev/null +++ b/src/app/app.tsx @@ -0,0 +1,13 @@ +"use client"; + +import dynamic from "next/dynamic"; + +const Demo = dynamic(() => import("~/components/Demo"), { + ssr: false, +}); + +export default function App() { + return ( + + ); +} diff --git a/src/app/opengraph-image.tsx b/src/app/opengraph-image.tsx new file mode 100644 index 0000000..c73206a --- /dev/null +++ b/src/app/opengraph-image.tsx @@ -0,0 +1,22 @@ +import { ImageResponse } from "next/og"; + +export const alt = "Farcaster Frames V2 Demo"; +export const size = { + width: 800, + height: 800, +}; + +export const contentType = "image/png"; + +export default async function Image() { + return new ImageResponse( + ( +
+

Frames v2 Demo

+
+ ), + { + ...size, + } + ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx index 2ef4cc3..46b15b9 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,15 +1,38 @@ -"use client"; +import { Metadata } from "next"; +import App from "./app"; -import dynamic from "next/dynamic"; +const appUrl = process.env.NEXT_PUBLIC_URL; -const Demo = dynamic(() => import("~/components/Demo"), { - ssr: false, -}); +const frame = { + version: "next", + imageUrl: `${appUrl}/opengraph-image`, + button: { + title: "Launch Frame", + action: { + type: "launch_frame", + name: "Farcaster Frames v2 Demo", + url: appUrl, + splashImageUrl: `${appUrl}/splash.png`, + splashBackgroundColor: "#f7f7f7", + }, + }, +}; + +export const revalidate = 300; + +export async function generateMetadata(): Promise { + return { + title: "Farcaster Frames v2 Demo", + openGraph: { + title: "Farcaster Frames v2 Demo", + description: "A Farcaster Frames v2 demo app.", + }, + other: { + "fc:frame": JSON.stringify(frame), + }, + }; +} export default function Home() { - return ( -
- -
- ); + return (); }