File size: 899 Bytes
97e41aa
 
38448fc
5411802
c3e8f3d
5411802
 
 
 
c3e8f3d
5411802
 
 
 
38448fc
 
 
 
f80b091
 
5411802
 
 
 
 
 
 
 
f80b091
5411802
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
29
30
31
32
33
34
35
import ChatCard, { ChatCardLayout } from './ChatCard';
import { IconPlus } from '../ui/Icons';
import { auth } from '@/auth';
import { ChatEntity } from '@/lib/types';

export interface ChatSidebarListProps {
  chats: ChatEntity[];
  isAdminView?: boolean;
}

export default async function ChatSidebarList({
  chats,
  isAdminView,
}: ChatSidebarListProps) {
  const session = await auth();
  if (!session || !session.user) {
    return null;
  }
  return (
    <>
      {!isAdminView && (
        <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} isAdminView={isAdminView} />
      ))}
    </>
  );
}