File size: 791 Bytes
c3e8f3d
97e41aa
 
38448fc
c3e8f3d
 
 
 
38448fc
 
 
 
f80b091
 
 
97e41aa
 
 
 
 
 
f80b091
d0a1b70
f80b091
 
 
c3e8f3d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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} />
      ))}
    </>
  );
}