From e0b406b7546addcdab62955fdb62467e419e391d Mon Sep 17 00:00:00 2001 From: XuhuiZhou Date: Wed, 11 Sep 2024 16:15:09 -0400 Subject: [PATCH] remove the server side of things --- app/t/[id]/opengraph-image.tsx | 106 --------------------------------- app/t/[id]/page.tsx | 56 ----------------- next.config.js | 44 +++++++------- 3 files changed, 22 insertions(+), 184 deletions(-) delete mode 100644 app/t/[id]/opengraph-image.tsx delete mode 100644 app/t/[id]/page.tsx diff --git a/app/t/[id]/opengraph-image.tsx b/app/t/[id]/opengraph-image.tsx deleted file mode 100644 index aa3d7b9..0000000 --- a/app/t/[id]/opengraph-image.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import { ImageResponse } from "next/server"; -import { notFound } from "next/navigation"; -import { kv } from "@vercel/kv"; - -export default async function DynamicOG({ - params, -}: { - params: { id: string }; -}) { - const data = await kv.hgetall<{ prompt: string; image?: string }>(params.id); - if (!data) { - return notFound(); - } - - const [inter] = await Promise.all([ - fetch( - "https://github.com/rsms/inter/raw/master/docs/font-files/Inter-Regular.woff", - ).then((res) => res.arrayBuffer()), - ]); - - return new ImageResponse( - ( -
-
-
- {data.prompt.substring(0, 72)} - {data.prompt.length > 72 && "..."} -
-
- - - - - -
-
-
- ), - { - width: 1200, - height: 630, - fonts: [ - { - name: "Inter", - data: inter, - }, - ], - headers: { - "cache-control": "public, max-age=60, stale-while-revalidate=86400", - }, - }, - ); -} diff --git a/app/t/[id]/page.tsx b/app/t/[id]/page.tsx deleted file mode 100644 index 7afcb04..0000000 --- a/app/t/[id]/page.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { kv } from "@vercel/kv"; -import { notFound } from "next/navigation"; -import { Metadata } from "next"; - -export async function generateMetadata({ - params, -}: { - params: { - id: string; - }; -}): Promise { - const data = await kv.hgetall<{ prompt: string; image?: string }>(params.id); - if (!data) { - return; - } - - const title = `sotopia: ${data.prompt}`; - const description = `A spiral generated from the prompt: ${data.prompt}`; - const image = data.image || "https://sotopia.vercel.app/opengraph-image.png"; - - return { - title, - description, - openGraph: { - title, - description, - }, - twitter: { - card: "summary_large_image", - title, - description, - creator: "@Hao_Zhu_", - }, - }; -} - -export default async function Results({ - params, -}: { - params: { - id: string; - }; -}) { - const data = await kv.hgetall<{ - prompt: string; - pattern?: string; - image?: string; - }>(params.id); - - if (!data) { - notFound(); - } - return ( - <> - ); -} diff --git a/next.config.js b/next.config.js index cafeb21..a2c11d5 100644 --- a/next.config.js +++ b/next.config.js @@ -1,33 +1,33 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - experimental: { - serverActions: true, - }, + output: 'export', images: { + unoptimized: true, + reactStrictMode: true, domains: [ "xd2kcvzsdpeyx1gu.public.blob.vercel-storage.com", "replicate.delivery", ], }, - async redirects() { - return [ - { - source: "/github", - destination: "https://github.com/steven-tey/sotopia", - permanent: false, - }, - { - source: "/deploy", - destination: "https://vercel.com/templates/next.js/sotopia", - permanent: false, - }, - { - source: "/t", - destination: "/", - permanent: false, - }, - ]; - }, + // async redirects() { + // return [ + // { + // source: "/github", + // destination: "https://github.com/steven-tey/sotopia", + // permanent: false, + // }, + // { + // source: "/deploy", + // destination: "https://vercel.com/templates/next.js/sotopia", + // permanent: false, + // }, + // { + // source: "/t", + // destination: "/", + // permanent: false, + // }, + // ]; + // }, }; module.exports = nextConfig;