Improve sidebar, new chat, and share dialog (#190)
This commit is contained in:
parent
35e83dc87e
commit
be90a40427
23 changed files with 598 additions and 217 deletions
42
components/sidebar-items.tsx
Normal file
42
components/sidebar-items.tsx
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
'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>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue