mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 01:44:13 +00:00
0331d9950f
A tour can now be a ride (HOR-01). The planner offers "Horse ride" as a tour type with its own horseshoe, and a Horse routes card beside the waypoints looks, when asked, for the route=horse relations OpenStreetMap knows in the map view. A route opens in a dialog that shows it on a map in the sections it is made of, split at forks, gaps and crossings, so nothing is ever joined across a gap. The rider picks a section and its direction, sees what the horse=* tags along it say (open, limited, closed, or unknown where untagged) and whether it is signposted the other way, and takes it as one undoable step. A section that does not start where the ride ends is only joined by a straight manual stretch once the rider switched that on. Nothing of a ride is routed: every leg follows a section or is drawn by hand, and the waypoint list and the map say which (a section as a solid line with its route, a manual stretch dashed and marked unchecked). A point at a section stays where the route has it, a ride works out no riding time, and distance, heights, day assignment, GPX import and export, the 3D view and the reversed ride keep working with each leg's origin saved and opened again. A failed lookup leaves the ride and the routes already found as they were. The server reads the routes through the shared Overpass client (GET /api/trips/:tripId/tours/horse-routes, Tours addon, trip access), keeps an answer twelve hours per grid-aligned view, and the tour contract refuses a routed leg, a via ferrata or a riding time on a ride and a horse route section on any other type. A migration enables the horse tour type.
19 lines
905 B
TypeScript
19 lines
905 B
TypeScript
import { horseRoutesResponseSchema, type HorseRoutesResponse } from '@trek/shared';
|
|
import { horseRoutesApi } from '../api/horseRoutes';
|
|
import { requireOnline } from './onlineOnly';
|
|
|
|
/**
|
|
* HOR-01: the signposted horse routes in a map view, from OpenStreetMap
|
|
* through the server. Online only on purpose: they are live map data asked
|
|
* for by hand, not trip data, and a section the rider takes is kept with the
|
|
* ride itself, so nothing here needs a copy on the device. Offline no request
|
|
* is made at all; every answer is parsed against the shared contract rather
|
|
* than cast, because its names and lines go on to be shown and saved.
|
|
*/
|
|
export const horseRouteRepo = {
|
|
async list(tripId: number | string, bbox: string, signal: AbortSignal): Promise<HorseRoutesResponse> {
|
|
requireOnline();
|
|
return horseRoutesResponseSchema.parse(await horseRoutesApi.list(tripId, bbox, signal));
|
|
},
|
|
};
|