/* ═══════════════════════════════════════════════════════════════ FEATURED CARDS A grid of cards that point somewhere: the front page's featured band now, the Community blog's posts next. The data comes from loadFeaturedCards in server/src/shape.js, already resolved, so this only draws. Three kinds of card: record links to the record's own page (hrefs.ts builds it) link links to its URL, a new tab when it leaves the site video VideoPlayer: a still with a play button that swaps in the player when pressed. The still is the card's image, else YouTube's thumbnail, else a plain panel. A photo fills the picture area; a logo sits inside it on a soft panel instead, since cropping a logo to 16:9 cuts it off. ═══════════════════════════════════════════════════════════════ */ import { useState } from 'react' import HomeLink from '../pages/sections/home/HomeLink.tsx' import VideoPlayer from './VideoPlayer.tsx' import { refHref } from '../lib/hrefs.ts' import { mediaUrl } from '../lib/media.ts' import type { FeaturedCard } from '../lib/useFrontPage.ts' /* Image kinds that are photographs, drawn edge to edge. Anything else is a logo, drawn whole. */ const PHOTO_KINDS = new Set(['event-background', 'featured', 'person']) function hrefFor(card: FeaturedCard): string | null { if (card.kind === 'record' && card.ref) { return refHref(card.ref.kind, card.ref.id, card.ref.org_kind) } return card.kind === 'link' ? card.url : null } function Picture({ card }: { card: FeaturedCard }) { const [failed, setFailed] = useState(false) const src = card.image ? mediaUrl(card.image.file) : null const photo = card.image ? PHOTO_KINDS.has(card.image.kind) : false if (!src || failed) { return
} return photo ? ({card.eyebrow}
)} {card.title && ({card.blurb}
}