'use client'; import { Archive, Building2, Eye, Hash, MapPin, MoreHorizontal, Pencil } from 'lucide-react'; import Link from 'next/link'; import { Button } from '@/components/ui/button'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { ListCard, ListCardAvatar, ListCardMeta } from '@/components/shared/list-card'; import { cn } from '@/lib/utils'; import { getCountryName } from '@/lib/i18n/countries'; import type { CompanyRow } from './company-columns'; const STATUS_COLORS: Record = { active: 'bg-green-100 text-green-800 border-green-300', dissolved: 'bg-red-100 text-red-800 border-red-300', }; const STATUS_LABELS: Record = { active: 'Active', dissolved: 'Dissolved', }; interface CompanyCardProps { company: CompanyRow; portSlug: string; onEdit: (company: CompanyRow) => void; onArchive: (company: CompanyRow) => void; } export function CompanyCard({ company, portSlug, onEdit, onArchive }: CompanyCardProps) { const statusLabel = STATUS_LABELS[company.status] ?? company.status; const statusColor = STATUS_COLORS[company.status] ?? 'bg-muted text-muted-foreground border-muted'; const country = company.incorporationCountryIso ? getCountryName(company.incorporationCountryIso, 'en') : null; const memberCount = company.memberCount ?? 0; const yachtCount = company.yachtCount ?? 0; const countParts: string[] = []; if (memberCount > 0) countParts.push(`${memberCount} ${memberCount === 1 ? 'member' : 'members'}`); if (yachtCount > 0) countParts.push(`${yachtCount} ${yachtCount === 1 ? 'yacht' : 'yachts'}`); // Skip legalName if it is identical to name or absent const showLegalName = company.legalName && company.legalName.toLowerCase() !== company.name.toLowerCase(); return ( View onEdit(company)}> Edit onArchive(company)}> Archive } >
} />
{/* Title row + spacer for actions button */}

{company.name}

{/* Legal name subtitle */} {showLegalName ? (

{company.legalName}

) : null} {/* Country + Tax ID meta line */} {country || company.taxId ? (
{country ? ( }>{country} ) : null} {company.taxId ? ( }>{company.taxId} ) : null}
) : null} {/* Member / yacht counts */} {countParts.length > 0 ? (

{countParts.join(' ยท ')}

) : null} {/* Status pill */} {company.status ? (
{statusLabel}
) : null}
); }