Video stills skip YouTube's gray placeholder; timeline back to teal dots; people rows fill

- A still that fails or comes back as YouTube's 120 x 90 "no
  thumbnail" image gives way to the next; with none left the player
  is a flat teal panel with the play button showing.
- Timeline: solid teal dots, a solid teal rail and teal decade tags
  (still on their branch), one color throughout, until a vine or
  tree drawing replaces them. The leaf colors are gone.
- People tiles fill each row with as many as fit (2 to 10), one
  fewer only when the last row would be a single tile, instead of
  evening rows out (8 where 6 fit had come out 4 and 4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-30 16:44:42 -05:00
parent 6506f65b1e
commit 57f8020542
11 changed files with 98 additions and 151 deletions

View file

@ -6,8 +6,10 @@
featured cards and the video content block.
The still is the caller's image, else YouTube's own thumbnail
(its 16:9 one, falling back to the 4:3 one cropped), else a plain
dark panel. The play button shows on hover or keyboard focus, and
(its 16:9 one, falling back to the 4:3 one cropped). Any still
that fails, or comes back as YouTube's gray "no thumbnail"
placeholder, gives way to the next; with none left it's a flat
teal panel with the play button always showing. The play button shows on hover or keyboard focus, and
always on a touch screen, which can't hover. Small rounded
corners, as the only rounded thing besides buttons and dots. A link that embeds.ts can't turn into a
player (not https, or not a host it knows how to frame) still
@ -18,7 +20,7 @@ import { Play } from '@phosphor-icons/react'
import { useState, type SyntheticEvent } from 'react'
import HomeLink from '../pages/sections/home/HomeLink.tsx'
import { playingSource, videoSource, videoThumbnail } from '../lib/embeds.ts'
import { playingSource, videoSource, videoThumbnails } from '../lib/embeds.ts'
import { BRAND } from '../lib/color.ts'
@ -35,6 +37,7 @@ export default function VideoPlayer({
className?: string
}) {
const [playing, setPlaying] = useState(false)
const [skipped, setSkipped] = useState(0)
const source = videoSource(url)
if (playing && source) {
@ -52,24 +55,36 @@ export default function VideoPlayer({
)
}
const image = still ?? videoThumbnail(url)
const stills = [...(still ? [still] : []), ...videoThumbnails(url)]
const image = stills[skipped] ?? null
const next = () => setSkipped((n) => n + 1)
// YouTube's 16:9 still is missing for some videos; its 4:3 one never is.
const fallBack = (event: SyntheticEvent<HTMLImageElement>) => {
// YouTube's placeholder for a missing still is a real 120 x 90 image,
// not an error, so it's caught by its size; wherever it came from,
// since Fetch preview may have saved one into the library.
const checkLoaded = (event: SyntheticEvent<HTMLImageElement>) => {
const img = event.currentTarget
if (img.src.endsWith('/hq720.jpg')) img.src = img.src.replace(/hq720\.jpg$/, 'hqdefault.jpg')
if (img.naturalWidth <= 120 && img.naturalHeight <= 90) next()
}
const face = (
<span className={`relative block overflow-hidden rounded-md ${className}`}>
{image ? (
<img src={image} alt="" loading="lazy" onError={fallBack} className="block aspect-video w-full object-cover" />
<img
key={image}
src={image}
alt=""
loading="lazy"
onError={next}
onLoad={checkLoaded}
className="block aspect-video w-full object-cover"
/>
) : (
<span className="block aspect-video w-full bg-[#004552]" />
)}
<span
aria-hidden="true"
className="video-play absolute inset-0 flex items-center justify-center transition-colors group-hover:bg-black/20 group-focus-visible:bg-black/20"
className={`video-play ${image ? '' : 'video-play--always'} absolute inset-0 flex items-center justify-center transition-colors group-hover:bg-black/20 group-focus-visible:bg-black/20`}
>
<span className="flex h-16 w-16 items-center justify-center rounded-full bg-white/95 shadow-lg transition-transform group-hover:scale-105">
<Play className="h-7 w-7" weight="fill" style={{ color: BRAND }} aria-hidden="true" />