homepage: bento 3-up + 300x600 inline; word-safe excerpt; bigger sponsor logos
- FeaturedBentoFromDb: row below the hero is now a 3-up rail on the left with the Blackmagic 300x600 on the right, aligned with the hero's right edge. SidebarAdStack skips that 300x600 so the article-feed sidebar starts with the 300x250 stack instead. - cleanExcerpt: render-time word-snap for excerpts that were hard-cut at a byte count (Matrox 50-years showed "Since 1976, the co" mid-word). Used on the bento hero subhead and the article-feed cards. - SponsorLogoStrip: now also pulls every tracked_companies.featured=true brand (Rode, TBC Consoles, Plura, Autocue, Autoscript, Filmcraft, Lectrosonics, Prompter People, SanDisk, Sennheiser), and logos go from h-10/h-12 max-w-140 → h-14/h-16 max-w-180 with thicker padding. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,23 +15,22 @@ async function fetchSponsors(): Promise<Sponsor[]> {
|
||||
.select("company_name_lower")
|
||||
.eq("property", "broadcastbeat");
|
||||
const names = Array.from(new Set((ads || []).map((r: any) => String(r.company_name_lower))));
|
||||
if (names.length === 0) return [];
|
||||
|
||||
const bb = createAdminClient();
|
||||
const { data: dir } = await bb
|
||||
.from("tracked_companies")
|
||||
.select("slug, company_name, logo_url")
|
||||
.eq("directory_visible", true)
|
||||
.in("company_name", names.map((n) => n)); // case-sensitive — directory should match
|
||||
// Some directory entries may have slightly different casing — fall back
|
||||
// to a case-insensitive single-name lookup for anything missed.
|
||||
const bySlug = new Map<string, Sponsor>();
|
||||
for (const d of (dir || []) as any[]) {
|
||||
bySlug.set(d.slug, { slug: d.slug, name: d.company_name, logoUrl: d.logo_url || null });
|
||||
}
|
||||
const matchedNames = new Set((dir || []).map((d: any) => String(d.company_name).toLowerCase()));
|
||||
const missing = names.filter((n) => !matchedNames.has(n));
|
||||
if (missing.length > 0) {
|
||||
|
||||
// Layer 1 — currently active advertisers.
|
||||
if (names.length > 0) {
|
||||
const { data: dir } = await bb
|
||||
.from("tracked_companies")
|
||||
.select("slug, company_name, logo_url")
|
||||
.eq("directory_visible", true)
|
||||
.in("company_name", names.map((n) => n));
|
||||
for (const d of (dir || []) as any[]) {
|
||||
bySlug.set(d.slug, { slug: d.slug, name: d.company_name, logoUrl: d.logo_url || null });
|
||||
}
|
||||
const matchedNames = new Set((dir || []).map((d: any) => String(d.company_name).toLowerCase()));
|
||||
const missing = names.filter((n) => !matchedNames.has(n));
|
||||
for (const n of missing) {
|
||||
const { data: hit } = await bb
|
||||
.from("tracked_companies")
|
||||
@@ -44,7 +43,21 @@ async function fetchSponsors(): Promise<Sponsor[]> {
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(bySlug.values()).filter((s) => s.logoUrl); // only show those with a logo
|
||||
// Layer 2 — pinned coverage partners (directory.featured=true). These
|
||||
// surface here whether or not they have an active ad campaign.
|
||||
const { data: pinned } = await bb
|
||||
.from("tracked_companies")
|
||||
.select("slug, company_name, logo_url")
|
||||
.eq("directory_visible", true)
|
||||
.eq("featured", true)
|
||||
.limit(40);
|
||||
for (const d of (pinned || []) as any[]) {
|
||||
if (!bySlug.has(d.slug)) {
|
||||
bySlug.set(d.slug, { slug: d.slug, name: d.company_name, logoUrl: d.logo_url || null });
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(bySlug.values()).filter((s) => s.logoUrl);
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
@@ -78,7 +91,7 @@ export default async function SponsorLogoStrip() {
|
||||
<img
|
||||
src={s.logoUrl || ""}
|
||||
alt={s.name}
|
||||
className="h-10 md:h-12 w-auto object-contain max-w-[140px] bg-white p-1.5 rounded"
|
||||
className="h-14 md:h-16 w-auto object-contain max-w-[180px] bg-white p-2 rounded"
|
||||
loading="lazy"
|
||||
/>
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user