import Link from "next/link"; import { createAdminClient } from "@/lib/supabase/admin"; interface CompanyTile { slug: string; name: string; logoUrl: string | null; bioShort: string; isActiveAdvertiser: boolean; exhibitsNab: boolean; exhibitsIbc: boolean; } async function loadTiles(slugs: string[]): Promise { if (slugs.length === 0) return []; try { const svc = createAdminClient(); const { data } = await svc .from("tracked_companies") .select("slug, company_name, logo_url, bio, exhibits_nab, exhibits_ibc") .in("slug", slugs); // Active advertiser lookup (set of company_name_lower) in adv schema. let advNames = new Set(); try { const adv = createAdminClient("adv"); const { data: ads } = await adv .from("active_advertisers_by_property") .select("company_name_lower") .eq("property", "broadcastbeat"); advNames = new Set((ads || []).map((r: any) => r.company_name_lower)); } catch { /* tolerate */ } const bySlug = new Map(); for (const r of (data || []) as any[]) { const name = String(r.company_name || "").trim(); bySlug.set(r.slug, { slug: r.slug, name, logoUrl: r.logo_url || null, bioShort: (r.bio || "").split(/(?<=[.!?])\s+/).slice(0, 1).join(" ").slice(0, 160), isActiveAdvertiser: advNames.has(name.toLowerCase()), exhibitsNab: !!r.exhibits_nab, exhibitsIbc: !!r.exhibits_ibc, }); } // Preserve the mention order return slugs.map((s) => bySlug.get(s)).filter(Boolean) as CompanyTile[]; } catch { return []; } } export default async function CompaniesInThisStory({ slugs }: { slugs: string[] }) { const tiles = await loadTiles(slugs); if (tiles.length === 0) return null; return (

Companies in this story

    {tiles.map((t) => (
  • {t.logoUrl ? ( /* eslint-disable-next-line @next/next/no-img-element */ ) : (
    {(t.name || "?").trim().charAt(0).toUpperCase()}
    )}
    {t.name}
    {t.isActiveAdvertiser && ( Sponsor )} {t.exhibitsNab && ( 2026 NAB Show )} {t.exhibitsIbc && ( IBC 2026 )}
    {t.bioShort && (

    {t.bioShort}

    )}
  • ))}
); }