vision-agent / components /sidebar-items.tsx
MingruiZhang's picture
init
3ba9c0c unverified
raw
history blame
1 kB
'use client'
import { Chat } from '@/lib/types'
import { AnimatePresence, motion } from 'framer-motion'
import { removeChat, shareChat } from '@/app/actions'
import { SidebarActions } from '@/components/sidebar-actions'
import { SidebarItem } from '@/components/sidebar-item'
interface SidebarItemsProps {
chats?: Chat[]
}
export function SidebarItems({ chats }: SidebarItemsProps) {
if (!chats?.length) return null
return (
<AnimatePresence>
{chats.map(
(chat, index) =>
chat && (
<motion.div
key={chat?.id}
exit={{
opacity: 0,
height: 0
}}
>
<SidebarItem index={index} chat={chat}>
<SidebarActions
chat={chat}
removeChat={removeChat}
shareChat={shareChat}
/>
</SidebarItem>
</motion.div>
)
)}
</AnimatePresence>
)
}