mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 00:20:07 +00:00
feat(tours): bike tours in the planner, CyclOSM, and the planned cards' last points (BIK-01 to BIK-06, RTE-01, IO-01, LIB-02)
The tour type is a dropdown; a bike tour picks its profile, routes for it, says when a point lies off every way, and shows what it runs on: surfaces, kinds of way and, for a mountain bike, the trail grades, each pointed at on the map. A type's own map (OpenHikingMap for a hike, CyclOSM for a bike tour) is offered while a tour of that type is open, with an admin switch each. From the planned cards: a hike avoids steep climbs, steps or ferries, nothing else; a saved tour can be shared where the platform takes GPX files; and the tours rail adds a tour from one menu: plan new, import GPX, or take one over from another trip.
This commit is contained in:
@@ -29,6 +29,8 @@ interface AddonState {
|
||||
toursWanderer: boolean
|
||||
/** Tours is on and the admin offers OpenHikingMap in its planner (MAP-01). */
|
||||
toursHikingMap: boolean
|
||||
/** Tours is on and the admin offers CyclOSM in its planner (BIK-06). */
|
||||
toursCycleMap: boolean
|
||||
loaded: boolean
|
||||
loadAddons: () => Promise<void>
|
||||
isEnabled: (id: string) => boolean
|
||||
@@ -39,6 +41,7 @@ export const useAddonStore = create<AddonState>((set, get) => ({
|
||||
bagTracking: false,
|
||||
toursWanderer: false,
|
||||
toursHikingMap: false,
|
||||
toursCycleMap: false,
|
||||
loaded: false,
|
||||
|
||||
loadAddons: async () => {
|
||||
@@ -47,6 +50,7 @@ export const useAddonStore = create<AddonState>((set, get) => ({
|
||||
set({ addons: data.addons || [], bagTracking: !!data.bagTracking,
|
||||
toursWanderer: !!data.toursWanderer,
|
||||
toursHikingMap: !!data.toursHikingMap,
|
||||
toursCycleMap: !!data.toursCycleMap,
|
||||
loaded: true,
|
||||
})
|
||||
} catch {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
/**
|
||||
* BIK-01 to BIK-05: the stretches of the planned route a card points at (a
|
||||
* surface, a kind of way, a trail grade), drawn over the route on the planner
|
||||
* map in the colour of what they are. `paint` names a token of the bike
|
||||
* paints, resolved where the map is drawn, so the theme decides the colour.
|
||||
*/
|
||||
export interface RouteHighlight {
|
||||
/** What is pointed at, so its row can show it is on. */
|
||||
id: string;
|
||||
lines: [number, number][][];
|
||||
paint: string;
|
||||
}
|
||||
|
||||
interface TourRouteHighlightState {
|
||||
highlight: RouteHighlight | null;
|
||||
show: (highlight: RouteHighlight | null) => void;
|
||||
clear: () => void;
|
||||
}
|
||||
|
||||
export const useTourRouteHighlightStore = create<TourRouteHighlightState>((set) => ({
|
||||
highlight: null,
|
||||
show: (highlight) => set({ highlight }),
|
||||
clear: () => set({ highlight: null }),
|
||||
}));
|
||||
Reference in New Issue
Block a user