Make the site faster to load and lighter on the server

- Every page but Home, and the whole admin, loads on first visit: the
  main bundle drops from 579 kB to 314 kB (173 to 98 kB gzipped); a
  tab on an old build reloads once when a page chunk has gone
- Home asks for events and the timeline alongside its own data, and
  the server preloads /api/front-page and the first hero photo
- Hero headline rises in as one piece (it held back the page's
  largest paint), sized to stay within two lines; min-h in dvh; first
  slide fetched at high priority
- Every raster upload gets a 640px copy (at upload, and at boot for
  older files); logos, avatars and card pictures load it and fall
  back to the full file
- Login password checks run off the event loop; only admin requests
  are logged per request; ffmpeg runs at nice 19 on Linux
- Page HTML is no-cache, so a deploy can't strand a cached page on
  missing assets; source maps are no longer linked
- Migration 042: index person_awards by award
- docs/performance.md, and gzip and HTTP/2 for nginx

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-29 02:41:45 -05:00
parent be7e92417e
commit f72a9604d2
23 changed files with 420 additions and 139 deletions

View file

@ -18,13 +18,13 @@
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'
import { useSmallImage } from '../lib/useSmallImage.ts'
/* Image kinds that are photographs, drawn edge to edge. Anything
else is a logo, drawn whole. */
@ -38,29 +38,28 @@ function hrefFor(card: FeaturedCard): string | null {
}
function Picture({ card }: { card: FeaturedCard }) {
const [failed, setFailed] = useState(false)
const src = card.image ? mediaUrl(card.image.file) : null
const img = useSmallImage(card.image ? mediaUrl(card.image.file) : null)
const photo = card.image ? PHOTO_KINDS.has(card.image.kind) : false
if (!src || failed) {
if (img.failed) {
return <div className="aspect-video w-full bg-tint" />
}
return photo ? (
<img
src={src}
src={img.src}
alt=""
loading="lazy"
onError={() => setFailed(true)}
onError={img.onError}
className="aspect-video w-full object-cover"
/>
) : (
<div className="flex aspect-video w-full items-center justify-center bg-tint p-8">
<img
src={src}
src={img.src}
alt=""
loading="lazy"
onError={() => setFailed(true)}
onError={img.onError}
className="max-h-full max-w-full object-contain"
/>
</div>