import { ArrowUpRight, ExternalLink, GitCompareArrows } from 'lucide-react'; import Link from 'next/link'; import { Chip, CompanyTierBadge, CountryChip, StatusBadge } from '@/components/ui/badges'; import { LiveAgo } from '@/components/ui/live'; import { countryName } from '@/lib/countries'; import { fmtInt, fmtPct, plural } from '@/lib/format'; import { descriptionOf, logoCandidates, socialsOf } from '@/lib/profile'; import { routes } from '@/lib/site'; import type { CompanyDetail } from '@/lib/types'; import { CompanyLogo } from './company-logo'; import { DescriptionAttribution } from './profile-panels'; import { WatchButton } from './watch-button'; /** * Company identity block: logo (profile logo → icon → monogram), name + legal name + legal form, domain / listing chips, * HQ, founded, employees (sourced count when known, else the stated band), industries, attributed description, socials, * watch + compare. Everything shown comes from the card or its enrichment profile — nothing is inferred here. */ export function CompanyHeader({ c }: { c: CompanyDetail }) { const p = c.profile ?? null; const desc = descriptionOf(c); const socials = socialsOf(p); const founded = p?.founded_year ?? c.founded_year; const hqCity = p?.hq?.city ?? c.hq_city; const hqRegion = p?.hq?.region ?? c.hq_region; const ticker = p?.ticker ?? c.ticker; const exchange = p?.exchange ?? c.exchange; const isPublic = p?.public_company || c.public_company; const legalLine = [c.legal_name && c.legal_name !== c.display_name ? c.legal_name : null, p?.legal_form].filter(Boolean).join(' · '); return (
Company {c.status !== 'ACTIVE' && }

{c.display_name}

{legalLine &&

{legalLine}

}
{c.canonical_domain} {isPublic && ticker && ( {ticker} {exchange ? · {exchange} : null} )} {hqCity && ( {hqCity} {hqRegion ? `, ${hqRegion}` : ''} )} {founded && est. {founded}} {typeof p?.employees === 'number' ? ( {fmtInt(p.employees)} employees{p.employees_year ? ` (${p.employees_year})` : ''} ) : ( c.employees_band && {c.employees_band} employees (stated) )}
{c.industries.map((i) => ( {i.replace(/-/g, ' ')} ))}
{desc && (

{desc.text}

)} {socials.length > 0 && ( )}
Compare

last observed

); } /** "32 active sensors · 18,420 observations · 786 historical changes · 249 structured events · historical coverage 94 %" */ export function DensityStrip({ c }: { c: CompanyDetail }) { const parts: string[] = [ `${fmtInt(c.counts.sensors)} active ${plural(c.counts.sensors, 'sensor')}`, `${fmtInt(c.counts.observations)} ${plural(c.counts.observations, 'observation')}`, `${fmtInt(c.counts.changes)} historical ${plural(c.counts.changes, 'change')}`, `${fmtInt(c.counts.events)} structured ${plural(c.counts.events, 'event')}`, ]; if (c.coverage?.historical_coverage !== null && c.coverage?.historical_coverage !== undefined) parts.push(`historical coverage ${fmtPct(c.coverage.historical_coverage, 0)}`); if (c.coverage?.first_observed_at) parts.push(`observed since ${new Date(c.coverage.first_observed_at).toISOString().slice(0, 10)}`); return (

{parts.map((p, i) => ( {i > 0 && ·} {p} ))}

); }