'use client'; import Link from 'next/link'; import { useParams } from 'next/navigation'; import { useQuery } from '@tanstack/react-query'; import { FileText, ExternalLink } from 'lucide-react'; import { apiFetch } from '@/lib/api/client'; import { Badge } from '@/components/ui/badge'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; interface BerthDealDoc { id: string; title: string; documentType: string; status: string; createdAt: string; interestId: string; } const STATUS_TONE: Record = { draft: 'outline', sent: 'secondary', partially_signed: 'secondary', completed: 'default', expired: 'destructive', cancelled: 'destructive', }; export function BerthDealDocumentsTab({ berthId }: { berthId: string }) { const params = useParams<{ portSlug: string }>(); const portSlug = params?.portSlug ?? ''; const { data: docs = [], isLoading } = useQuery({ queryKey: ['berth-interest-documents', berthId], queryFn: () => apiFetch<{ data: BerthDealDoc[] }>(`/api/v1/berths/${berthId}/interest-documents`).then( (r) => r.data, ), }); return (

EOIs, contracts, and other deal documents attached to interests currently linked to this berth. Read-only - to send, sign, or edit, open the document on the linked interest's page.

Linked deal documents {isLoading ? (

Loading…

) : docs.length === 0 ? (

No deal documents yet. Documents created on a linked interest will appear here.

) : (
    {docs.map((doc) => (
  • {doc.title} {doc.documentType}
    {doc.status} Open
  • ))}
)}
); }