'use client'; import type { DetailTab } from '@/components/shared/detail-layout'; import { EmptyState } from '@/components/shared/empty-state'; import { CompanyMembersTab } from '@/components/companies/company-members-tab'; import { CompanyOwnedYachtsTab } from '@/components/companies/company-owned-yachts-tab'; interface CompanyTabsCompany { id: string; name: string; legalName: string | null; taxId: string | null; registrationNumber: string | null; incorporationCountry: string | null; incorporationDate: string | null; status: string; billingEmail: string | null; notes: string | null; } interface CompanyTabsOptions { companyId: string; portSlug: string; currentUserId?: string; company: CompanyTabsCompany; } const STATUS_LABELS: Record = { active: 'Active', dissolved: 'Dissolved', }; function InfoRow({ label, value }: { label: string; value?: string | number | null }) { if (value === null || value === undefined || value === '') return null; return (
{label}
{value}
); } function formatDate(value: string | null): string | null { if (!value) return null; const date = new Date(value); if (Number.isNaN(date.getTime())) return value; return date.toLocaleDateString(); } function OverviewTab({ company }: { company: CompanyTabsCompany }) { const incorporationDate = formatDate(company.incorporationDate); return (
{/* Identity */}

Identity

{/* Registration */} {(company.taxId || company.registrationNumber || company.incorporationCountry || incorporationDate) && (

Registration

)} {/* Contact */} {company.billingEmail && (

Contact

)} {/* Notes */} {company.notes && (

Notes

{company.notes}

)}
); } export function getCompanyTabs({ companyId, portSlug, // currentUserId reserved for when NotesList supports entityType='companies'. currentUserId: _currentUserId, company, }: CompanyTabsOptions): DetailTab[] { void _currentUserId; return [ { id: 'overview', label: 'Overview', content: , }, { id: 'members', label: 'Members', content: , }, { id: 'owned-yachts', label: 'Owned Yachts', content: , }, { id: 'addresses', label: 'Addresses', // TODO: wire to future company-addresses endpoint (see company-addresses schema). content: ( ), }, { id: 'documents', label: 'Documents', content: , }, { id: 'notes', label: 'Notes', // TODO: NotesList currently supports entityType 'clients' | 'interests'. // Extend NotesList (or swap to a company-notes endpoint) in a follow-up. content: ( ), }, { id: 'tags', label: 'Tags', // TODO: replace with an inline tag editor once one exists; company tags // can be edited via the Edit form in the meantime. content: ( ), }, ]; }