Page features: directory and blog post tabs, image converter, version names

- Featured event badge: above the event's card from lg up, left out on phones
- Version names from the tag (The Region Cards Update) in the site and admin footers
- Tools -> Image converter (JPG, PNG, WebP in the browser) and Download as in Media
- People directory sections take several tags, a tab each (migration 078)
- Tab blocks split a blog post into tabs; contents follow the open tab (migration 079)
- The side nav sun fades out as the page scrolls into the footer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aidan Dona 2026-10-16 19:37:07 -05:00
parent a6c66d4607
commit 31afa889d6
28 changed files with 878 additions and 70 deletions

View file

@ -25,8 +25,9 @@ const slug = (text: string) =>
.slice(0, 60) || 'section'
/* One entry per heading or subheading block, in order, and the id
for each block index that is one. */
export function headingAnchors(blocks?: ContentBlock[] | null): {
for each block index that is one. prefix keeps a blog post's tabs
apart (splitTabs): "Overview" in two tabs is two ids. */
export function headingAnchors(blocks?: ContentBlock[] | null, prefix = ''): {
entries: ContentsEntry[]
idAt: Map<number, string>
} {
@ -40,9 +41,39 @@ export function headingAnchors(blocks?: ContentBlock[] | null): {
const base = slug(text)
const n = (seen.get(base) ?? 0) + 1
seen.set(base, n)
const id = n === 1 ? base : `${base}-${n}`
const id = `${prefix}${n === 1 ? base : `${base}-${n}`}`
idAt.set(index, id)
entries.push({ id, text, level: block.type === 'heading' ? 1 : 2 })
})
return { entries, idAt }
}
/* ── A blog post's tabs (079) ──────────────────────────────────
A 'tab' block starts a tab, titled by its text, holding the
blocks after it up to the next; the blocks before the first are
the intro above the tabs. Each tab's heading ids start with its
own, so the same heading in two tabs is two ids; the intro's
keep their plain ids. */
export type PostTab = { id: string; title: string; prefix: string; blocks: ContentBlock[] }
export function splitTabs(blocks?: ContentBlock[] | null): { intro: ContentBlock[]; tabs: PostTab[] } {
const intro: ContentBlock[] = []
const tabs: PostTab[] = []
const seen = new Map<string, number>()
for (const block of blocks ?? []) {
if (block.type === 'tab') {
const title = (block.text ?? '').trim() || `Part ${tabs.length + 1}`
const base = `tab-${slug(title)}`
const n = (seen.get(base) ?? 0) + 1
seen.set(base, n)
const id = n === 1 ? base : `${base}-${n}`
tabs.push({ id, title, prefix: `${id}-`, blocks: [] })
} else if (tabs.length) {
tabs[tabs.length - 1].blocks.push(block)
} else {
intro.push(block)
}
}
return { intro, tabs }
}