'use client'; import { Archive, Building2, Eye, MoreHorizontal, Pencil, Ship, User } 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 type { YachtRow } from './yacht-columns'; const STATUS_COLORS: Record = { active: 'bg-green-100 text-green-800 border-green-300', retired: 'bg-gray-100 text-gray-800 border-gray-300', sold_away: 'bg-amber-100 text-amber-800 border-amber-300', }; const STATUS_LABELS: Record = { active: 'Active', retired: 'Retired', sold_away: 'Sold Away', }; interface YachtCardProps { yacht: YachtRow; portSlug: string; onEdit: (yacht: YachtRow) => void; onArchive: (yacht: YachtRow) => void; } export function YachtCard({ yacht, portSlug, onEdit, onArchive }: YachtCardProps) { const statusLabel = STATUS_LABELS[yacht.status] ?? yacht.status; const statusColor = STATUS_COLORS[yacht.status] ?? 'bg-muted text-muted-foreground border-muted'; // Prefer metric dimensions; fall back to imperial let dimText: string | null = null; if (yacht.lengthM || yacht.widthM) { const l = yacht.lengthM ?? '-'; const w = yacht.widthM ?? '-'; dimText = `${l}m × ${w}m`; } else if (yacht.lengthFt || yacht.widthFt) { const l = yacht.lengthFt ?? '-'; const w = yacht.widthFt ?? '-'; dimText = `${l}ft × ${w}ft`; } const metaParts: string[] = []; if (dimText) metaParts.push(dimText); if (yacht.hullNumber) metaParts.push(`Hull #${yacht.hullNumber}`); const OwnerIcon = yacht.currentOwnerType === 'company' ? Building2 : User; return ( View onEdit(yacht)}> Edit onArchive(yacht)}> Archive } >
} />
{/* Title row + spacer for actions button */}

{yacht.name}

{/* Owner subtitle */} {yacht.currentOwnerName ? (

{yacht.currentOwnerName}

) : null} {/* Dimensions · Hull number */} {metaParts.length > 0 ? (
{metaParts.map((part, i) => ( {i > 0 ? · : null} {part} ))}
) : null} {/* Status pill */} {yacht.status ? (
{statusLabel}
) : null}
); }