Spaces:
Sleeping
Sleeping
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} /> | |
))} | |
</> | |
); | |
} | |