feat: implement sharing
This commit is contained in:
parent
385b31d42c
commit
8cc3fea048
19 changed files with 507 additions and 96 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { getChats, removeChat } from '@/app/actions'
|
||||
import { getChats, removeChat, shareChat } from '@/app/actions'
|
||||
import { SidebarActions } from '@/components/sidebar-actions'
|
||||
|
||||
import { SidebarItem } from '@/components/sidebar-item'
|
||||
|
||||
|
|
@ -9,19 +10,24 @@ export interface SidebarListProps {
|
|||
export async function SidebarList({ userId }: SidebarListProps) {
|
||||
const chats = await getChats(userId)
|
||||
|
||||
console.log(chats)
|
||||
|
||||
return (
|
||||
<div className="flex-1 overflow-auto">
|
||||
{chats?.length ? (
|
||||
<div className="space-y-2 px-2">
|
||||
{chats.map(chat => (
|
||||
<SidebarItem
|
||||
key={chat.id}
|
||||
title={chat.title}
|
||||
href={`/chat/${chat.id}`}
|
||||
id={chat.id}
|
||||
removeChat={removeChat}
|
||||
/>
|
||||
))}
|
||||
{chats.map(
|
||||
chat =>
|
||||
chat && (
|
||||
<SidebarItem key={chat?.id} chat={chat}>
|
||||
<SidebarActions
|
||||
chat={chat}
|
||||
removeChat={removeChat}
|
||||
shareChat={shareChat}
|
||||
/>
|
||||
</SidebarItem>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="p-8 text-center">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue