From 1b61c394a5a6cda49086cc7d6596fd3b80862737 Mon Sep 17 00:00:00 2001 From: shadcn Date: Fri, 16 Jun 2023 19:52:46 +0400 Subject: [PATCH] feat: update og display --- app/share/[id]/opengraph-image.tsx | 165 ++++++++--------------------- 1 file changed, 47 insertions(+), 118 deletions(-) diff --git a/app/share/[id]/opengraph-image.tsx b/app/share/[id]/opengraph-image.tsx index 04fd22d..03698df 100644 --- a/app/share/[id]/opengraph-image.tsx +++ b/app/share/[id]/opengraph-image.tsx @@ -1,11 +1,11 @@ import { ImageResponse } from 'next/server' import { getSharedChat } from '@/app/actions' -import { formatDate } from '@/lib/utils' export const runtime = 'edge' export const alt = 'AI Chatbot' + export const size = { width: 1200, height: 630 @@ -34,137 +34,66 @@ export default async function Image({ params }: ImageProps) { return null } + const textAlign = chat?.title?.length > 40 ? 'items-start' : 'items-center' + return new ImageResponse( ( -
-
-
- {chat.title.length > 120 - ? `${chat.title.slice(0, 120)}...` - : chat.title} +
+
+
+
+ + + +
+
+ {chat.title.length > 120 + ? `${chat.title.slice(0, 120)}...` + : chat.title} +
-
- {formatDate(chat.createdAt)} ยท {chat.messages.length} messages +
+
+ + + +
+
+ ... +
- - - - - - - + -
Built with Vercel KV
+
+ Built with{' '} +
Vercel AI SDK
& +
KV
+
- - - - - - - - - - - - - - - - - - - - - +
demo.nextjs.chat
),