FastAPI + Celery + Next.js + Postgres/Redis app with company monitoring, source collection, LLM-based change analysis, enrichment, and account security (Turnstile, escalating lockout, email verification).
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
"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<string, string>;
|
|
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 (
|
|
<Link
|
|
href={href}
|
|
title={title}
|
|
className="focus-ring inline-flex items-center gap-1 rounded-full bg-slate-100 px-3 py-1 text-xs text-slate-700 transition-colors duration-150 hover:bg-brand-100 hover:text-brand-700"
|
|
>
|
|
{name}
|
|
{subtitle && <span className="text-slate-400">· {subtitle}</span>}
|
|
</Link>
|
|
);
|
|
}
|