// Paths: the motif strip (only while the bottom timeline is hidden), then one row per motif of the song with
// where it was heard before, where it plays here and where it returns, the followed motif's whole thread,
// and the chart of the nine places.
import { motifs, sagaOf, songs, type AlbumSong, type Motif } from "../../data/album";
import { chartSvg } from "./chart";
import { dot, esc, hitsOf, motifsOf } from "./util";
export function pathsView(song: AlbumSong, pick: string | null, showStrip: boolean): HTMLElement {
const el = document.createElement("div");
el.className = "paths";
const ms = motifsOf(song);
const followed = pick ? motifs.find((m) => m.id === pick) ?? null : null;
el.innerHTML = `
${showStrip ? motifStrip(song, ms) : ""}
Motif threads
${ms.length
? `
Each thread is a motif or a character's theme. Pick one to follow it through the album.
`;
}
/** The followed motif: what it is and every song it plays in. */
function threadDetail(song: AlbumSong, m: Motif): string {
const hits = hitsOf(m.id);
return `