import React from 'react'; import { Avatar, StatusBadge } from './leadUi'; import { leadFullName, leadInitials, type Lead } from '../../types'; export type SortKey = 'name' | 'company' | 'status' | 'connections' | 'updated_at'; export interface SortConfig { key: SortKey; direction: 'asc' | 'desc'; } interface LeadListProps { leads: Lead[]; connectionCount: (leadId: number) => number; sortConfig: SortConfig; onSort: (key: SortKey) => void; onEdit: (lead: Lead) => void; onDelete: (lead: Lead) => void; } const COLUMNS: { key: SortKey | null; label: string; className?: string }[] = [ { key: 'name', label: 'Kontakt' }, { key: 'company', label: 'Unternehmen' }, { key: 'status', label: 'Status' }, { key: null, label: 'Erreichbarkeit' }, { key: 'connections', label: 'Verbindungen' }, { key: null, label: 'Angelegt von' }, { key: 'updated_at', label: 'Geaendert' }, ]; export const LeadList: React.FC = ({ leads, connectionCount, sortConfig, onSort, onEdit, onDelete, }) => (
{COLUMNS.map((column) => ( ))} {leads.map((lead) => ( onEdit(lead)} className="group cursor-pointer transition hover:bg-brand-50/40" > ))}
onSort(column.key!) : undefined} className={`px-5 py-3.5 text-[10px] font-extrabold uppercase tracking-wider text-ink-400 ${ column.key ? 'cursor-pointer select-none transition hover:text-brand-600' : '' }`} > {column.label} {column.key && sortConfig.key === column.key && ( )}

{leadFullName(lead)}

{lead.position &&

{lead.position}

}

{lead.company || '—'}

{lead.city &&

{lead.city}

}
{lead.email ? ( event.stopPropagation()} className="block truncate text-ink-600 transition hover:text-brand-600" > {lead.email} ) : ( keine E-Mail )} {(lead.phone || lead.mobile) && ( {lead.phone || lead.mobile} )}
{connectionCount(lead.id)}

{lead.created_by_name || '—'}

{lead.updated_at ? new Date(lead.updated_at).toLocaleDateString('de-DE') : '—'}

);