// The page addresses a spec opens, from the same table the app links with. // // A spec that writes `page.goto("/browse/" + id)` by hand pins today's URL; one // that writes `page.goto(urls.projectHref(id))` follows the app when P3 moves // /browse to /projects. Old addresses keep working through redirects.mjs either // way -- this is so a spec states WHERE it means to be, not where that was. // // Assertions on hrefs (`toHaveAttribute("href", …)`) should build the expected // value here too, so a URL change is one edit in lib/hrefs.ts. import { projectHref } from "../lib/hrefs"; import { ARTICLE_SECTION_TAB, PIECE_FOLDED, tabOfSection } from "../lib/pieces/tabs.mjs"; import { songTabOfSection } from "../lib/pieces/song-tabs.mjs"; export * from "../lib/hrefs"; export { REDIRECTS } from "../redirects.mjs"; /** * The piece page's tab that holds `name` (lib/pieces/tabs.mjs SECTION_TAB): * `section("reports/x", "deliver")` is `/projects/reports/x?tab=deliver`. A * project page is tabs since P4a-1, and a spec that opened it to reach one * section says which, so a section moving tab is one edit in that table. */ export function section(project: string, name: string, q: { all?: boolean; note?: string } = {}): string { // A section of what folded into Deliver (L7b: Build's, Media's) is asked for by its old tab: an unclaimed project // 308s it to Deliver, a claimed one goes to its article piece's own Build or Media tab (which it keeps). const was = (ARTICLE_SECTION_TAB as Record)[name]; return projectHref(project, { tab: was && was in PIECE_FOLDED ? was : tabOfSection(name), ...q }); } /** * A song piece's tab that holds `name` (lib/pieces/song-tabs.mjs * SONG_SECTION_TAB): `songSection("alpha", "cuts")` is `/projects/alpha?tab=cuts`. * The song counterpart of `section` -- a song's sections are its own (P4a-3). */ export function songSection(song: string, name: string, q: { note?: string } = {}): string { return projectHref(song, { tab: songTabOfSection(name), ...q }); } // ── the addresses L7b moved into the workspace (umtool redesign): what a redirect spec asks for ──────────────── // The app no longer builds these (lib/hrefs.ts builds where they land), so a spec that checks the redirect names // the old address here, once. import { encodePath, withQuery } from "../lib/hrefs"; /** The old present-mode page: `/projects/

/present` (it 308s to the workspace's `?mode=present`). */ export function legacyPresentHref(project: string, q: { take?: string | null } = {}): string { return withQuery(`/projects/${encodePath(project)}/present`, { take: q.take }); } /** A bare `/projects/

/play` (it 308s to the workspace; Play's own page always carries a query). */ export function barePlayHref(project: string): string { return `/projects/${encodePath(project)}/play`; }