fix(book): the designed book paces its bursts, lists and maps the way the design asks

A burst of four or more photos within a quarter of an hour becomes one grid,
no beat runs three times in a row, and an entry's pros and cons go into the
room under its words on the opener, the panorama or the quiet page, with a
note when they find none. A chapter map is the map of the chapter's trip, and
entries on no trip are named in the notes. The sorts compare by code unit, the
summary metrics and the page lookups exist once, and a flag or country mark
asked for by its own code is labelled with that country.
This commit is contained in:
Maurice
2026-10-23 01:45:16 +00:00
parent 7d736e1a34
commit 2becbd17bc
14 changed files with 603 additions and 149 deletions
+20 -1
View File
@@ -15,6 +15,7 @@ import {
} from './book-ops-core';
import {
bookBadgeValue,
bookCountryName,
bookEntryListItems,
bookTravelBadge,
bookTravelCountries,
@@ -342,13 +343,31 @@ function newBadge(spec: Extract<TravelSpec, { kind: 'badge' }>, id: string, at:
}
const value = {
text,
sub: spec.sub ?? resolved?.sub ?? '',
sub: spec.sub ?? badgeSub(spec, resolved?.sub, resolved?.code, travel) ?? '',
code: spec.code ?? ownCode ?? resolved?.code ?? null,
};
const frame = at(bookTravelSize('badge', env.page, { variant: spec.variant }));
return bookTravelBadge({ id, frame, variant: spec.variant, value });
}
/** The marks whose code names a country. */
const COUNTRY_MARKS: ReadonlySet<string> = new Set(['flag', 'country']);
/**
* A flag or country mark asked for by its own code is labelled with that
* country; the journey's value names its first country, the one a mark
* without a code shows.
*/
function badgeSub(
spec: Extract<TravelSpec, { kind: 'badge' }>,
sub: string | undefined,
code: string | null | undefined,
travel: BookTravelContext | undefined,
): string | undefined {
if (!travel || !spec.code || !COUNTRY_MARKS.has(spec.variant)) return sub;
return spec.code === code ? sub : bookCountryName(spec.code, travel.locale, travel.stats);
}
function newList(spec: Extract<TravelSpec, { kind: 'list' }>, id: string, at: At, env: ElementOpEnv): BookElement {
const travel = travelFor(spec.entryId, env);
let items = spec.items ?? [];