mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +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.
66 lines
2.4 KiB
TypeScript
66 lines
2.4 KiB
TypeScript
/**
|
|
* Which help screen the trip page announces.
|
|
*
|
|
* The trip is a family of help screens: the frame, one per tab, on the plan
|
|
* one per overlay that is open, and on the Tours tab one per kind of tour.
|
|
* A screen that has no help yet falls back to the next one up, so the panel
|
|
* never opens on "No guide for this screen".
|
|
*/
|
|
|
|
/** The tab ids are historical; the help screens carry the names the tabs show. */
|
|
const TRIP_TAB_HELP: Record<string, string> = {
|
|
transports: 'transports',
|
|
buchungen: 'bookings',
|
|
listen: 'lists',
|
|
finanzplan: 'costs',
|
|
dateien: 'files',
|
|
collab: 'collab',
|
|
roadtrip: 'roadtrip',
|
|
'tour-planner': 'tour-planner',
|
|
};
|
|
|
|
/** Hike and run share a screen: both are planned on foot with the trail details card. */
|
|
const TOUR_TYPE_HELP: Record<string, string> = {
|
|
hike: 'trip-tour-hike',
|
|
run: 'trip-tour-hike',
|
|
walk: 'trip-tour-walk',
|
|
bike: 'trip-tour-bike',
|
|
kayak: 'trip-tour-paddle',
|
|
horse: 'trip-tour-horse',
|
|
ski: 'trip-tour-ski',
|
|
};
|
|
|
|
export interface TripHelpState {
|
|
activeTab: string;
|
|
roadtripActive: boolean;
|
|
/** A tour's card is open (it is the selected place too, so it is asked first). */
|
|
tourCardOpen: boolean;
|
|
placeOpen: boolean;
|
|
dayDetailOpen: boolean;
|
|
/** The places column shows its Tours list. */
|
|
toursList: boolean;
|
|
/** What the Tours tab's planner holds. */
|
|
plannerMode: 'neutral' | 'new-draft' | 'edit-saved' | 'view-gpx';
|
|
plannerTourType: string;
|
|
}
|
|
|
|
export function tripHelpScreen(state: TripHelpState, known: (id: string) => boolean): string {
|
|
const first = (...ids: string[]): string => ids.find(known) ?? 'trip';
|
|
if (state.activeTab === 'plan') {
|
|
if (state.roadtripActive) return first('trip-roadtrip');
|
|
if (state.tourCardOpen) return first('trip-tour-detail', 'trip-tours');
|
|
if (state.placeOpen) return first('trip-place');
|
|
if (state.dayDetailOpen) return first('trip-day-detail');
|
|
if (state.toursList) return first('trip-tours');
|
|
return 'trip';
|
|
}
|
|
if (state.activeTab === 'tour-planner') {
|
|
if (state.plannerMode === 'view-gpx') return first('trip-tour-import', 'trip-tour-planner');
|
|
if (state.plannerMode === 'new-draft' || state.plannerMode === 'edit-saved') {
|
|
return first(TOUR_TYPE_HELP[state.plannerTourType] ?? '', 'trip-tour-planner');
|
|
}
|
|
return first('trip-tour-planner');
|
|
}
|
|
return first(`trip-${TRIP_TAB_HELP[state.activeTab] ?? state.activeTab}`);
|
|
}
|