manufacturers + NAB Show naming sweep

- Standardize "NAB Show" / "2026 NAB Show" across badges, filter chips,
  and headings; never bare "NAB" in user-facing copy.
- /manufacturers/[slug]: normalize show name at render, strip
  randomstring suffix on booth, hide booth unless the show is within 90
  days, filter single-letter junk out of category display.
- News filter "NAB Show" chip loose-matches any nab-tagged article so
  legacy "NAB 2026" tags still surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ryan Salazar
2026-05-27 22:07:29 +00:00
parent ec3118e7bc
commit 95eba5794b
9 changed files with 101 additions and 50 deletions

View File

@@ -9,6 +9,36 @@ export const revalidate = 1800;
type Params = { slug: string };
// Known show date ranges. Booth numbers only render when the show is
// upcoming within 90 days; otherwise the row is shown without a booth.
const SHOW_DATES: Record<string, { start: string; end: string }> = {
"NAB Show:2026": { start: "2026-04-11", end: "2026-04-16" },
"NAB Show NY:2026": { start: "2026-10-21", end: "2026-10-23" },
"IBC:2026": { start: "2026-09-11", end: "2026-09-14" },
"NAB Show:2027": { start: "2027-04-17", end: "2027-04-22" },
};
function normaliseShowName(raw: string | null | undefined): string {
const s = (raw || "").trim();
if (!s) return s;
if (/^nab(\s*show)?$/i.test(s)) return "NAB Show";
if (/^nab\s*(show\s*)?(ny|new\s*york)$/i.test(s)) return "NAB Show NY";
if (/^ibc(\s*show)?$/i.test(s)) return "IBC";
return s;
}
function shouldShowBooth(show: string, year: number | null): boolean {
if (!year) return false;
const dates = SHOW_DATES[`${show}:${year}`];
if (!dates) return false;
const today = new Date();
const start = new Date(dates.start + "T00:00:00Z");
const end = new Date(dates.end + "T23:59:59Z");
if (today > end) return false;
const daysUntilStart = (start.getTime() - today.getTime()) / 86_400_000;
return daysUntilStart <= 90;
}
async function loadManufacturer(slug: string) {
const supabase = await createClient();
const { data } = await supabase
@@ -163,12 +193,12 @@ export default async function ManufacturerProfile({
<div className="flex items-center gap-2 flex-wrap text-xs">
{company.exhibits_nab && (
<span className="bg-amber-500/15 text-amber-300 px-2 py-0.5 rounded font-semibold uppercase tracking-wider">
NAB Show 2026
2026 NAB Show
</span>
)}
{company.exhibits_ibc && (
<span className="bg-blue-500/15 text-blue-300 px-2 py-0.5 rounded font-semibold uppercase tracking-wider">
IBC
IBC 2026
</span>
)}
{(company.hq_city || company.hq_country) && (
@@ -315,21 +345,27 @@ export default async function ManufacturerProfile({
</section>
)}
{company.categories && company.categories.length > 0 && (
<section className="mb-10">
<h2 className="text-lg font-display font-bold text-[#e0e0e0] mb-2">Categories</h2>
<div className="flex flex-wrap gap-2">
{company.categories.map((c: string) => (
<span
key={c}
className="text-xs bg-[#1a1a1a] text-[#aaa] px-2.5 py-1 rounded-full"
>
{c}
</span>
))}
</div>
</section>
)}
{(() => {
const cleanCategories = (company.categories || []).filter(
(c: string) => typeof c === "string" && c.trim().length >= 2
);
if (cleanCategories.length === 0) return null;
return (
<section className="mb-10">
<h2 className="text-lg font-display font-bold text-[#e0e0e0] mb-2">Categories</h2>
<div className="flex flex-wrap gap-2">
{cleanCategories.map((c: string) => (
<span
key={c}
className="text-xs bg-[#1a1a1a] text-[#aaa] px-2.5 py-1 rounded-full"
>
{c}
</span>
))}
</div>
</section>
);
})()}
{shows.length > 0 && (
<section className="mb-10">
@@ -337,21 +373,27 @@ export default async function ManufacturerProfile({
Trade-show appearances
</h2>
<ul className="space-y-2">
{shows.map((s) => (
<li
key={`${s.show}-${s.show_year}-${s.booth || "?"}`}
className="bg-[#111] border border-[#252525] rounded-md px-4 py-3 flex items-center justify-between gap-4"
>
<div className="min-w-0">
<span className="font-semibold text-[#e0e0e0]">
{s.show} {s.show_year}
</span>
{s.booth && (
<span className="ml-3 text-sm text-[#888]">Booth {s.booth}</span>
)}
</div>
</li>
))}
{shows.map((s) => {
const showName = normaliseShowName(s.show);
const label = showName === "NAB Show"
? `${s.show_year} NAB Show`
: `${showName} ${s.show_year}`;
const cleanBooth = (s.booth || "").replace(/randomstring\s*$/i, "").trim();
const renderBooth = cleanBooth && shouldShowBooth(showName, s.show_year);
return (
<li
key={`${s.show}-${s.show_year}-${s.booth || "?"}`}
className="bg-[#111] border border-[#252525] rounded-md px-4 py-3 flex items-center justify-between gap-4"
>
<div className="min-w-0">
<span className="font-semibold text-[#e0e0e0]">{label}</span>
{renderBooth && (
<span className="ml-3 text-sm text-[#888]">Booth {cleanBooth}</span>
)}
</div>
</li>
);
})}
</ul>
</section>
)}