mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 23:46:35 +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.
145 lines
4.0 KiB
TypeScript
145 lines
4.0 KiB
TypeScript
import { vi } from 'vitest';
|
|
|
|
/**
|
|
* What a stubbed tour planner needs beyond the fields a test sets: a hike, no
|
|
* boat, no loop and the route tools as spies. Spread first, so a test's own
|
|
* fields win.
|
|
*/
|
|
export function hikePlannerDefaults() {
|
|
return {
|
|
tourType: 'hike' as const,
|
|
alpineAcknowledged: false,
|
|
acknowledgeAlpine: vi.fn(),
|
|
setTourType: vi.fn(),
|
|
isPaddle: false,
|
|
isBike: false,
|
|
isHorse: false,
|
|
bikeProfile: 'touring' as const,
|
|
setBikeProfile: vi.fn(),
|
|
// SKI-02: no ski tour, so no discipline chosen nor asked for.
|
|
isSki: false,
|
|
ski: { choice: { discipline: null, technique: null }, change: vi.fn(), setOption: vi.fn(), load: vi.fn() },
|
|
skiRoute: null,
|
|
skiMissing: null,
|
|
// RUN-01: no run, so no pace asked for.
|
|
isRun: false,
|
|
runProfile: 'running' as const,
|
|
setRunProfile: vi.fn(),
|
|
runPace: { paceSecondsPerKm: null, setPace: vi.fn(), load: vi.fn() },
|
|
runPaceMissing: false,
|
|
runPaceInvalid: false,
|
|
unreachable: null,
|
|
paddle: {
|
|
boatType: null,
|
|
waterContext: null,
|
|
speedKmh: null,
|
|
portageSpeedKmh: null,
|
|
lakeStyle: 'direct' as const,
|
|
recommendedSpeedKmh: null,
|
|
effectiveSpeedKmh: null,
|
|
setBoatType: vi.fn(),
|
|
setWaterContext: vi.fn(),
|
|
setSpeedKmh: vi.fn(),
|
|
setPortageSpeedKmh: vi.fn(),
|
|
setLakeStyle: vi.fn(),
|
|
adoptRecommendedSpeed: vi.fn(),
|
|
load: vi.fn(),
|
|
},
|
|
paddleSpeedInvalid: false,
|
|
paddleIncomplete: false,
|
|
paddleEstimate: null,
|
|
editPaddlePoints: vi.fn(),
|
|
amendWaypoints: vi.fn(),
|
|
isLoop: false,
|
|
reverse: vi.fn(),
|
|
returnToStart: vi.fn(),
|
|
toggleWaypointFreeLeg: vi.fn(),
|
|
insertShapingPoint: vi.fn(() => null),
|
|
insertShapingPoints: vi.fn(() => null),
|
|
setWaypointShaping: vi.fn(),
|
|
recomputeLeg: vi.fn(),
|
|
routeDrawnLegsOnWater: vi.fn(),
|
|
legVariants: idleLegVariants(),
|
|
roundHikes: idleRoundHikes(),
|
|
paddleRoute: null,
|
|
routeCurrent: false,
|
|
routeParts: null,
|
|
mapOverlays: new Set<string>(),
|
|
mapOverlaysOff: new Set<string>(),
|
|
toggleMapOverlay: vi.fn(),
|
|
tripId: 1,
|
|
editWaypoints: vi.fn(),
|
|
// CW-07: a draft planned in TREK, not read from a Google Maps walk.
|
|
draftSource: null,
|
|
// MDT-01: a day tour, no stage set and none that may be.
|
|
stages: {
|
|
multiDay: false,
|
|
stages: [],
|
|
endCount: 0,
|
|
lost: 0,
|
|
setMultiDay: vi.fn(),
|
|
toggleStageEnd: vi.fn(),
|
|
canEnd: vi.fn(() => false),
|
|
},
|
|
// CW-12: a walk with no crossing by boat and no leg it cannot join.
|
|
walkFerries: {
|
|
crossings: [],
|
|
pending: [],
|
|
blocksSave: false,
|
|
gap: null,
|
|
acceptable: vi.fn(() => true),
|
|
accept: vi.fn(),
|
|
release: vi.fn(),
|
|
show: vi.fn(),
|
|
},
|
|
// P2C-03: a tour opened at its first revision, with nothing known about others.
|
|
revision: {
|
|
base: null,
|
|
baseRef: { current: null },
|
|
conflict: null,
|
|
remote: null,
|
|
adopt: vi.fn(),
|
|
notice: vi.fn(() => false),
|
|
refuse: vi.fn(() => false),
|
|
takeOver: vi.fn(),
|
|
dismissConflict: vi.fn(),
|
|
dismissRemote: vi.fn(),
|
|
},
|
|
};
|
|
}
|
|
|
|
/** RTE-02: a planner comparing no section, with its actions as spies. */
|
|
export function idleLegVariants() {
|
|
return {
|
|
comparison: null,
|
|
focus: null,
|
|
canCompare: vi.fn(() => false),
|
|
compare: vi.fn(),
|
|
select: vi.fn(),
|
|
hover: vi.fn(),
|
|
apply: vi.fn(),
|
|
close: vi.fn(),
|
|
appliedHint: { shown: false, key: null, undo: vi.fn(), hold: vi.fn() },
|
|
};
|
|
}
|
|
|
|
/** RTE-03: a planner offering no round hike, with its actions as spies. */
|
|
export function idleRoundHikes() {
|
|
return {
|
|
view: null,
|
|
focus: null,
|
|
frame: null,
|
|
canStart: vi.fn(() => false),
|
|
open: vi.fn(),
|
|
find: vi.fn(),
|
|
back: vi.fn(),
|
|
select: vi.fn(),
|
|
hover: vi.fn(),
|
|
apply: vi.fn(),
|
|
confirm: vi.fn(),
|
|
cancelConfirm: vi.fn(),
|
|
close: vi.fn(),
|
|
appliedHint: { shown: false, key: null, undo: vi.fn(), hold: vi.fn() },
|
|
};
|
|
}
|