'use client'; import { Anchor, Archive, Compass, MoreHorizontal, Pencil } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { TagBadge } from '@/components/shared/tag-badge'; import { ListCard, ListCardAvatar, ListCardMeta, deriveInitials, } from '@/components/shared/list-card'; import { cn } from '@/lib/utils'; import { stageBadgeClass, stageDotClass, stageLabel as toStageLabel } from '@/lib/constants'; import type { InterestRow } from './interest-columns'; const CATEGORY_LABELS: Record = { general_interest: 'General', specific_qualified: 'Qualified', hot_lead: 'Hot lead', }; const SOURCE_LABELS: Record = { website: 'Website', manual: 'Manual', referral: 'Referral', broker: 'Broker', }; interface InterestCardProps { interest: InterestRow; portSlug: string; onEdit: (interest: InterestRow) => void; onArchive: (interest: InterestRow) => void; } export function InterestCard({ interest, portSlug, onEdit, onArchive }: InterestCardProps) { const stageLabel = toStageLabel(interest.pipelineStage); const stagePill = stageBadgeClass(interest.pipelineStage); const accentClass = stageDotClass(interest.pipelineStage); const isHotLead = interest.leadCategory === 'hot_lead'; const categoryLabel = interest.leadCategory ? CATEGORY_LABELS[interest.leadCategory] : null; const sourceLabel = interest.source ? (SOURCE_LABELS[interest.source] ?? interest.source) : null; const tags = interest.tags ?? []; const clientName = interest.clientName ?? 'Unknown client'; const berthLabel = interest.berthMooringNumber; return ( onEdit(interest)}> Edit onArchive(interest)}> Archive } >
{/* Title row: name + spacer for the absolutely-positioned actions menu */}

{clientName}

{/* Berth or general-interest line */}

{berthLabel ? ( <> {berthLabel} ) : ( <> General interest )}

{/* Stage pill + category + source */}
{stageLabel} {isHotLead ? ( Hot ) : null} {(categoryLabel && !isHotLead) || sourceLabel ? (
{categoryLabel && !isHotLead ? {categoryLabel} : null} {categoryLabel && !isHotLead && sourceLabel ? ยท : null} {sourceLabel ? {sourceLabel} : null}
) : null}
{tags.length > 0 ? (
{tags.slice(0, 2).map((tag) => ( ))} {tags.length > 2 ? ( +{tags.length - 2} ) : null}
) : null}
); }