import React from 'react';
import clsx from 'clsx';
import { useTranslation } from 'react-i18next';
import { Badge } from '@/components/ui/Badge';
import { Pagination } from '@/components/ui/Pagination';
import { EmptyState } from '@/components/ui/EmptyState';
import type { UnifiedContact } from '@/api/hooks';
export type ContactViewMode = 'list' | 'table' | 'cards';
export interface ContactListProps {
contacts: UnifiedContact[];
selectedContactId: string | null;
onSelectContact: (contact: UnifiedContact) => void;
loading?: boolean;
currentPage: number;
total: number;
pageSize: number;
onPageChange: (page: number) => void;
viewMode: ContactViewMode;
sortBy: string;
sortOrder: 'asc' | 'desc';
onSortChange: (sortBy: string, sortOrder: 'asc' | 'desc') => void;
}
function TypeBadge({ type }: { type: string }) {
const { t } = useTranslation();
return (
| handleSort('type')} aria-sort={sortBy === 'type' ? (sortOrder === 'asc' ? 'ascending' : 'descending') : 'none'} > {t('contacts.type')}{sortIcon('type')} | handleSort('displayname')} aria-sort={sortBy === 'displayname' ? (sortOrder === 'asc' ? 'ascending' : 'descending') : 'none'} > {t('contacts.fullName')}{sortIcon('displayname')} | handleSort('email_1')} aria-sort={sortBy === 'email_1' ? (sortOrder === 'asc' ? 'ascending' : 'descending') : 'none'} > {t('contacts.email')}{sortIcon('email_1')} | {t('contacts.phone')} | handleSort('mailing_city')} aria-sort={sortBy === 'mailing_city' ? (sortOrder === 'asc' ? 'ascending' : 'descending') : 'none'} > {t('address.city')}{sortIcon('mailing_city')} | {t('tags.title')} | |
|---|---|---|---|---|---|---|
| e.stopPropagation()}> | {getDisplayName(contact)} | {getEmail(contact)} | {getPhone(contact)} | {getCity(contact)} |
{getTags(contact).slice(0, 3).map((tag) => (
|