'use client'; import Link from 'next/link'; import { useParams } from 'next/navigation'; import { format } from 'date-fns'; import { Table, TableHeader, TableBody, TableCell, TableHead, TableRow, } from '@/components/ui/table'; import { Badge } from '@/components/ui/badge'; import { EmptyState } from '@/components/shared/empty-state'; interface ClientCompaniesTabProps { clientId: string; companies: Array<{ membershipId: string; role: string; isPrimary: boolean; startDate: string | Date; company: { id: string; name: string; legalName: string | null; status: string; }; }>; } function formatSince(startDate: string | Date): string { const d = typeof startDate === 'string' ? new Date(startDate) : startDate; if (Number.isNaN(d.getTime())) return '—'; return format(d, 'MMM d, yyyy'); } export function ClientCompaniesTab({ clientId: _clientId, companies }: ClientCompaniesTabProps) { const routeParams = useParams<{ portSlug: string }>(); const portSlug = routeParams?.portSlug ?? ''; if (companies.length === 0) { return ( ); } return (

Company affiliations

Company Role Primary Since {companies.map((m) => ( {m.company.name} {m.company.legalName && ( ({m.company.legalName}) )} {m.role.replace('_', ' ')} {m.isPrimary ? ( Primary ) : ( )} {formatSince(m.startDate)} ))}
); }