From 1233ffee9f0749658e5e3df8580dddf7005aeb50 Mon Sep 17 00:00:00 2001 From: Robert Wagner Date: Fri, 20 Nov 2026 06:40:40 -0500 Subject: [PATCH 1/8] The episode page, built around its stage The third slice of the media-first redesign (#76). An episode opens on its stage (EpisodeStage): the picture or artwork, the play controls and a live transcript line. Below it, a sticky section bar leads to the show notes, the people (guests first, hosts after), sponsors, the transcript and onward episodes. Transcript timestamps become seek chips (seek-chip in the rehype plugin), and whoever is speaking lights up wherever their portrait is. The episode page's styles are imported by the shell slice, which swaps in the new layout. Co-Authored-By: Claude Opus 5.5 --- .../starpod/src/components/EpisodeStage.astro | 212 ++ .../starpod/src/components/PersonFace.astro | 32 + .../src/components/episode/BarPlay.tsx | 42 + .../episode/CreatorsAndGuests.astro | 91 - .../src/components/episode/LiveTurn.tsx | 169 ++ .../components/episode/MarkdownTranscript.tsx | 23 +- .../src/components/episode/Onward.astro | 152 ++ .../src/components/episode/People.astro | 225 ++ .../src/components/episode/SectionBar.astro | 231 ++ .../src/components/episode/SeekChip.tsx | 13 + .../src/components/episode/ShowNotes.tsx | 91 + .../src/components/episode/SpeakerCard.tsx | 145 ++ .../src/components/episode/SponsorCards.astro | 53 + .../src/components/episode/Sponsors.astro | 46 +- .../src/components/episode/Tiles.astro | 35 + .../src/components/episode/Transcript.tsx | 93 +- .../starpod/src/components/episode/focus.ts | 27 + .../src/components/episode/speaking-source.ts | 134 + .../src/components/episode/speaking.ts | 10 + .../starpod/src/components/episode/split.ts | 384 +++ .../lib/rehype-transcript-timestamps.d.mts | 4 + .../src/lib/rehype-transcript-timestamps.mjs | 139 +- packages/starpod/src/pages/[episode].astro | 680 ++++- packages/starpod/src/styles/episode.css | 2217 +++++++++++++++++ packages/starpod/src/styles/people.css | 118 + packages/starpod/src/styles/stage.css | 335 +++ packages/starpod/src/styles/worlds.css | 542 ++++ .../unit/rehype-transcript-timestamps.test.ts | 110 +- tests/unit/seek-chip.test.tsx | 105 + 29 files changed, 6134 insertions(+), 324 deletions(-) create mode 100644 packages/starpod/src/components/EpisodeStage.astro create mode 100644 packages/starpod/src/components/PersonFace.astro create mode 100644 packages/starpod/src/components/episode/BarPlay.tsx delete mode 100644 packages/starpod/src/components/episode/CreatorsAndGuests.astro create mode 100644 packages/starpod/src/components/episode/LiveTurn.tsx create mode 100644 packages/starpod/src/components/episode/Onward.astro create mode 100644 packages/starpod/src/components/episode/People.astro create mode 100644 packages/starpod/src/components/episode/SectionBar.astro create mode 100644 packages/starpod/src/components/episode/SeekChip.tsx create mode 100644 packages/starpod/src/components/episode/ShowNotes.tsx create mode 100644 packages/starpod/src/components/episode/SpeakerCard.tsx create mode 100644 packages/starpod/src/components/episode/SponsorCards.astro create mode 100644 packages/starpod/src/components/episode/Tiles.astro create mode 100644 packages/starpod/src/components/episode/focus.ts create mode 100644 packages/starpod/src/components/episode/speaking-source.ts create mode 100644 packages/starpod/src/components/episode/speaking.ts create mode 100644 packages/starpod/src/components/episode/split.ts create mode 100644 packages/starpod/src/styles/episode.css create mode 100644 packages/starpod/src/styles/people.css create mode 100644 packages/starpod/src/styles/stage.css create mode 100644 packages/starpod/src/styles/worlds.css create mode 100644 tests/unit/seek-chip.test.tsx diff --git a/packages/starpod/src/components/EpisodeStage.astro b/packages/starpod/src/components/EpisodeStage.astro new file mode 100644 index 00000000..c51858c8 --- /dev/null +++ b/packages/starpod/src/components/EpisodeStage.astro @@ -0,0 +1,212 @@ +--- +import { matchNames, sortCast, voiceFor, type CastPerson } from '../lib/cast'; +import { getEpisodeCues } from '../lib/episode-cues'; +import { optimizeImage } from '../lib/optimize-episode-image'; +import type { Episode, Show } from '../lib/rss'; +import { dasherize } from '../utils/dasherize'; +import { formatDuration, toPlayable } from '../utils/playable'; +import { ArrowOutIcon, HeadphonesIcon, VideoIcon } from './icons'; +import Sponsors from './episode/Sponsors.astro'; +import LiveScript from './media/LiveScript'; +import PersonFace from './PersonFace.astro'; +import StageControls from './media/StageControls'; + +import type { ImageMetadata } from 'astro'; +import { getImage } from 'astro:assets'; +import starpodConfig from 'virtual:starpod/config'; +import avatarLight from '../assets/avatar-light.png'; + +export interface Props { + episode: Episode; + show: Show; + /** + * The episode's hosts and guests, from the guests/sponsors database. Empty + * (or absent) when the database isn't enabled: no cast is shown. + */ + people?: Array; + /** The episode's sponsors from the database; the row hides when empty. */ + sponsors?: Array<{ id: string; img: string | null; name: string; url: string }>; + /** `feature` on the home page (links on to the episode), `page` on its own page. */ + variant: 'feature' | 'page'; + /** + * Divide the stage between the picture and the live transcript with a + * draggable divider (desktop, when the episode has a transcript). See + * `episode/split.ts`. + */ + split?: boolean; +} + +const { episode, people = [], show, sponsors = [], split = false, variant } = Astro.props; +const playable = toPlayable(episode, show); +const Heading = variant === 'page' ? 'h1' : 'h2'; +const art = + (await optimizeImage(episode.episodeImage ?? show.image, { width: 960, height: 960 })) ?? + show.image; +const date = new Date(episode.published); +const titleId = `stage-title-${episode.id.replace(/[^a-z0-9]/gi, '')}`; +const scriptId = `stage-script-${episode.id.replace(/[^a-z0-9]/gi, '')}`; +const presets = [ + ['watch', 'Watch'], + ['balanced', 'Balanced'], + ['read', 'Read'] +]; + +// The cast: this episode's own hosts and guests, in credit order. Anyone who +// speaks as one of the transcript's two main voices wears that voice's face. +const photos = import.meta.glob<{ default: ImageMetadata }>( + '/src/img/people/*.{jpeg,jpg,png}' +); +const cues = people.length ? await getEpisodeCues(episode) : null; +const names = people.map((person) => person.name); +const speakerOf = matchNames(names, [...new Set(cues?.flatMap((cue) => (cue.n ? [cue.n] : [])))], { + surnames: true +}); +const cast = await Promise.all( + sortCast(people, starpodConfig.hosts.map((host) => host.name)).map(async (person) => { + const source = + (person.img && (await photos[`/src/img/people/${person.img}`]?.())?.default) || + avatarLight; + const image = await getImage({ src: source, width: 112, height: 112, format: 'webp' }); + return { + guest: !person.isHost, + name: person.name, + speaksAs: speakerOf.get(person.name), + src: image.src, + voice: voiceFor(person.name, cues, names) + }; + }) +); +--- + +
+
+
+ +
+ + {`${episode.title} +
+ +
+
+ +
+ + {episode.title} + +

+ {episode.episodeNumber === 'Bonus' ? 'Bonus' : `Episode ${episode.episodeNumber}`} + + {formatDuration(episode.duration)} + + {episode.video ? : } + {episode.video ? 'Video' : 'Audio'} + +

+ { + cast.length > 0 && ( +
    + {cast.map((person) => ( +
  • + + + {person.name} + + {person.guest ? 'Guest' : 'Host'} + + +
  • + ))} +
+ ) + } + +

{episode.description}

+ + { + variant === 'feature' && ( + + Show notes and transcript + + + ) + } +
+
+ + { + split && ( +