/** ContactsPanelContent — ADR-119 extracted from usePanelContent.tsx */ import React from 'react'; import { X, Search, Star, Loader2 } from 'lucide-react'; import { cn } from '@/shared/utils/cn'; import { AccordionContactItem } from '../../../AccordionContactItem'; import type { PanelContentDeps } from './PanelContentTypes'; export function ContactsPanelContent(d: PanelContentDeps) { return (
d.setContactsSearch(e.target.value)} placeholder="Поиск контактов..." className="w-full pl-8 pr-3 py-1.5 text-sm rounded-lg bg-[var(--bg-tertiary)] text-[var(--text-primary)] placeholder:text-[var(--text-tertiary)] border-none focus:outline-none focus:ring-2 focus:ring-[var(--color-primary-500)]/30" />
{d.isLoadingUsers ? (
) : d.filteredUsers.length === 0 ? (
{d.contactsSearch ? 'Не найдено' : 'Нет контактов'}
) : ( d.filteredUsers.map(user => { const isInChat = d.chatParticipants.some(p => p.id === user.id); const isCurrent = d.chatPartner?.type === 'user' && d.chatPartner.id === user.id; const isFavorite = d.favorites.includes(user.id); return ( { d.selectConversation(chatId); d.setActivePanel('none'); }} onToggleFavorite={d.toggleFavorite} onAddToGroup={d.handleAddToGroup} onCreateNewChat={(targetUser: typeof user) => { d.forceNewChatRef.current = true; d.createNewConversation(); d.setUserConversationId(null); d.setChatPartner({ type: 'user', id: targetUser.id, name: targetUser.name, avatarUrl: targetUser.avatar_url ?? undefined, email: targetUser.email ?? undefined }); d.setChatParticipants([{ type: targetUser.managed_by_agent_table_id ? 'agent' : 'user', id: targetUser.id, name: targetUser.name, email: targetUser.email ?? undefined, avatar: targetUser.avatar_url ?? undefined }]); d.setActivePanel('none'); }} /> ); }) )}
); }