Spaces:
Sleeping
Sleeping
import { getKVChats } from '@/lib/kv/chat'; | |
import ChatCard, { ChatCardLayout } from './ChatCard'; | |
import { IconPlus } from '../ui/Icons'; | |
import { auth } from '@/auth'; | |
export interface ChatSidebarListProps {} | |
export default async function ChatSidebarList({}: ChatSidebarListProps) { | |
const session = await auth(); | |
if (!session || !session.user) { | |
return null; | |
} | |
const chats = await getKVChats(); | |
return ( | |
<> | |
<ChatCardLayout link="/chat"> | |
<div className="overflow-hidden flex items-center size-full"> | |
<IconPlus className="w-1/4 font-bold" /> | |
<p className="text-sm w-3/4 ml-3 font-bold">New chat</p> | |
</div> | |
</ChatCardLayout> | |
{chats.map(chat => ( | |
<ChatCard key={chat.id} chat={chat} /> | |
))} | |
</> | |
); | |
} | |