Files
TREK/client/src/components/Tours/planner/useTourMapView.ts
T
Maurice 9494521ac7 feat(tours): plan paddle tours, hand-drawn legs, reverse and return to start, maps per tour type
- Paddle as a plannable tour type: one boat (kayak, canoe, SUP, other), river or
  lake, a pace that a boat change never overwrites; time is distance over pace
- Hand-drawn legs beside routed ones, drawn dotted and labelled as not routed,
  kept through save, reopen and edits elsewhere
- Reverse a tour and close it back to its start, each one undo step
- GPX import shows a preview first (line, measures, duplicates, type) and only
  the confirmation stores the tour
- Base maps and overlays per tour type in the planner: hike keeps topo and the
  via ferrata layer, paddle gets the OpenSeaMap seamark overlay
2026-10-16 23:14:52 +02:00

22 lines
878 B
TypeScript

import { useCallback, useState } from 'react';
import type { TourBaseLayer } from '../../Map/MapLayerSwitcher';
/**
* How the planner's map looks, kept with the planner so it lasts while tours
* are opened, saved and closed: the base layer and the overlays switched on.
* Planner-local by design (P2B-07): nothing here touches the global map
* setting, and none of it changes a tour.
*/
export function useTourMapView() {
const [mapBaseLayer, setMapBaseLayer] = useState<TourBaseLayer>('default');
const [mapOverlays, setMapOverlays] = useState<ReadonlySet<string>>(() => new Set());
const toggleMapOverlay = useCallback((id: string) => {
setMapOverlays((current) => {
const next = new Set(current);
if (!next.delete(id)) next.add(id);
return next;
});
}, []);
return { mapBaseLayer, setMapBaseLayer, mapOverlays, toggleMapOverlay };
}