import { User, Users, Plus, Search, Lock } from 'lucide-react';
import { useState } from 'react';
export default function ChatList({ chats, activeChatId, onSelectChat, onCreateGroup }) {
const [searchTerm, setSearchTerm] = useState('');
const [showCreateModal, setShowCreateModal] = useState(false);
const filteredChats = chats.filter(chat =>
chat.name.toLowerCase().includes(searchTerm.toLowerCase())
);
return (
{/* Search & Actions */}
{/* Chat List */}
{filteredChats.map((chat) => (
onSelectChat(chat.id)}
className={`flex items-center gap-3 p-3 cursor-pointer transition-colors hover:bg-white/5 ${activeChatId === chat.id ? 'bg-white/10' : ''}`}
>
{chat.isGroup ? : chat.name.charAt(0)}
{chat.name}
{chat.lastTime}
{chat.encrypted && }
{chat.lastMessage}
{chat.unread > 0 && (
{chat.unread}
)}
))}
{/* Create Group Modal (Simple Implementation) */}
{showCreateModal && (
New Group
Create a secure group for up to 20 people. All messages are end-to-end encrypted.
)}
);
}