Spaces:
Runtime error
Runtime error
File size: 944 Bytes
ddac6a2 ee61dec ddac6a2 f2fe7c8 |
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 36 |
import React from 'react';
function ChatList({ chats, currentChat, onSelectChat, onDeleteChat, onCreateNewChat, collapsed }) {
return (
<div className="chat-list">
<button className="new-chat" onClick={onCreateNewChat}>
New Chat
</button>
{chats.length === 0 ? (
<div className="empty-state">No conversations yet</div>
) : (
chats.map(chat => (
<div
key={chat.id}
className={`chat-item ${chat.id === currentChat?.id ? 'active' : ''}`}
onClick={() => onSelectChat(chat.id)}
>
<span>{chat.title}</span>
<button
className="delete-btn"
onClick={(e) => {
e.stopPropagation();
onDeleteChat(chat.id);
}}
>
Delete
</button>
</div>
))
)}
</div>
);
}
export default ChatList;
|