2025-10-28 11:21:04 -04:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { Badge } from '@/components/ui/badge';
|
|
|
|
|
import { User } from 'lucide-react';
|
|
|
|
|
|
|
|
|
|
interface ContactCellProps {
|
|
|
|
|
contactId?: number;
|
2025-11-19 14:18:16 -05:00
|
|
|
contacts?: Record<number, any>;
|
2025-10-28 11:21:04 -04:00
|
|
|
}
|
|
|
|
|
|
2025-11-19 14:18:16 -05:00
|
|
|
export function ContactCell({ contactId, contacts }: ContactCellProps) {
|
2025-10-28 11:21:04 -04:00
|
|
|
if (!contactId) {
|
|
|
|
|
return <span className="text-xs text-muted-foreground">-</span>;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-19 14:18:16 -05:00
|
|
|
// Get contact from the contacts map
|
|
|
|
|
const contact = contacts?.[contactId];
|
|
|
|
|
|
|
|
|
|
if (contact) {
|
|
|
|
|
const contactName = `${contact.firstName || ''} ${contact.lastName || ''}`.trim();
|
|
|
|
|
if (contactName) {
|
|
|
|
|
return (
|
|
|
|
|
<Badge variant="outline" className="text-xs">
|
|
|
|
|
<User className="w-3 h-3 mr-1" />
|
|
|
|
|
{contactName}
|
|
|
|
|
</Badge>
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-10-28 11:21:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <span className="text-xs text-muted-foreground">ID: {contactId}</span>;
|
|
|
|
|
}
|