import { type Metadata } from 'next'; import { notFound } from 'next/navigation'; import { formatDate } from '@/lib/utils'; import { getSharedChat } from '@/app/actions'; import { ChatList } from '@/components/chat/ChatList'; interface SharePageProps { params: { id: string; }; } export async function generateMetadata({ params, }: SharePageProps): Promise { const chat = await getSharedChat(params.id); return { title: chat?.title.slice(0, 50) ?? 'Chat', }; } export default async function SharePage({ params }: SharePageProps) { const chat = await getSharedChat(params.id); if (!chat || !chat?.sharePath) { notFound(); } return ( <>

{chat.title}

{formatDate(chat.createdAt)} ยท {chat.messages.length} messages
); }