mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-13 07:40:59 +00:00
31859651d7
Every help screen checked against the v5 redesign. Tours is documented for the first time, as a screen of its own with twelve screens under it, and notifications get help of their own. All pictures are taken again on a realistic demo trip, with short loops where a still cannot show the motion. The English is plain and every language is written naturally rather than word for word. The switcher shows two levels at most, a screen's overview lists its sub-screens as cards above its guides, each wiki page is linked once, and the help sidebar is wider. Fixes found along the way: Save to Collection keeps a tour's route, a track dropped on the places column opens the Tours import, tour Share on desktop, the unsaved tour draft lives on the account, a route click no longer adds an end point, Trip places leaves the trip's tours out, Escape closes a stage's day menu, confirms before destructive deletes, DWD warnings sharing one id kept apart, a booking's date moves with it, and smaller fixes across notifications, bookings, the day plan, stays, Atlas, Collections, Vacay and the admin screens.
77 lines
2.4 KiB
TypeScript
77 lines
2.4 KiB
TypeScript
import type { HelpContext, HelpDocLink, HelpGuide, HelpGuideSize, HelpIcon } from './types'
|
|
|
|
/**
|
|
* One screen's whole registration, written once.
|
|
*
|
|
* Every `contexts/*.ts` file used to carry its own copy of the same little
|
|
* factory and the same context literal; the screens of a trip alone would have
|
|
* made thirteen copies of it. That repetition is what a duplication check
|
|
* counts, and it is exactly the hand-mirrored state the repository's rules ask
|
|
* us not to keep. So the shape lives here and a context file is data only: the
|
|
* ids, the counts, the docs and what relates to what.
|
|
*
|
|
* A guide is a row rather than an object because the rows are read as a table:
|
|
* one line per guide, the numbers under each other.
|
|
*/
|
|
|
|
export type GuideRow = [
|
|
id: string,
|
|
icon: HelpIcon,
|
|
size: HelpGuideSize,
|
|
steps: number,
|
|
tips: number,
|
|
docs: HelpDocLink | undefined,
|
|
related: string[],
|
|
/** Whether the guide carries a picture of the state after its last step. Default: no. */
|
|
result?: boolean,
|
|
/** Steps that also come as a short loop (see HelpGuideMedia.clips). */
|
|
clips?: number[],
|
|
]
|
|
|
|
export interface ScreenSpec {
|
|
id: string
|
|
icon: HelpIcon
|
|
/** How many "on this screen" bullets the catalogue has for it. */
|
|
bullets: number
|
|
/** Where the reference documentation continues. */
|
|
docs: HelpDocLink[]
|
|
/** The guides, in the order the panel lists them. */
|
|
guides: GuideRow[]
|
|
/** The screen this one lives under, for the switcher. */
|
|
parent?: string
|
|
/** Where the screen is in the app, for the "go there" button. */
|
|
route?: string
|
|
/** Whether `help-media/ctx/<id>.webp` exists. Default: yes. */
|
|
hero?: boolean
|
|
}
|
|
|
|
/** The context and the guides of one screen, from one description of it. */
|
|
export function defineScreen(spec: ScreenSpec): { context: HelpContext; guides: HelpGuide[] } {
|
|
const guides: HelpGuide[] = spec.guides.map(
|
|
([id, icon, size, steps, tips, docs, related, result = false, clips]): HelpGuide => ({
|
|
id,
|
|
context: spec.id,
|
|
icon,
|
|
size,
|
|
steps,
|
|
tips,
|
|
media: clips?.length ? { steps: true, result, clips } : { steps: true, result },
|
|
docs,
|
|
related,
|
|
}),
|
|
)
|
|
return {
|
|
guides,
|
|
context: {
|
|
id: spec.id,
|
|
parent: spec.parent,
|
|
route: spec.route,
|
|
icon: spec.icon,
|
|
bullets: spec.bullets,
|
|
guides: guides.map(g => g.id),
|
|
docs: spec.docs,
|
|
hero: spec.hero ?? true,
|
|
},
|
|
}
|
|
}
|