"use client"; import Link from "next/link"; /** * A company-name pill that links to that company's page if it's already * monitored, or to the add-company wizard (pre-filled) otherwise. Shared * by the company detail page's Overview Competitors section and the * Enrichment tab's Competitors/Customers sections so all three behave * identically. */ export function CompanyPillLink({ name, subtitle, monitoredByName, returnTo, }: { name: string; subtitle?: string; monitoredByName: Map; returnTo: string; }) { const existingId = monitoredByName.get(name.trim().toLowerCase()); const href = existingId ? `/companies/${existingId}` : `/companies/new?name=${encodeURIComponent(name)}&returnTo=${encodeURIComponent(returnTo)}`; const title = existingId ? `${name} is already being monitored — view it` : `Add ${name} to monitoring`; return ( {name} {subtitle && · {subtitle}} ); }