Files
TREK/client/src/components/Tours/paddle/usePaddleWaypointActions.ts
T
Maurice 2c3b20bb57 feat(tours): paddle portages and locks, paddle time, wind at the start and obstacle data from OpenStreetMap
PAD-03 portages and locks on planned tours and recorded tracks, PAD-07 paddle time with portage and lock stops, PAD-08 wind forecast for the start, PAD-05A regional obstacle import from Geofabrik extracts with admin endpoints and a monthly refresh, PAD-05B first cut of the obstacle layer on Leaflet, GL and 3D. Work in progress: checklist (PAD-06), check bench (PAD-09), admin UI, translations and tests follow.
2026-10-16 23:44:58 +02:00

24 lines
985 B
TypeScript

import type { PaddleLock } from '@trek/shared';
import { useCallback } from 'react';
import { setPortageExtraMinutes, setWaypointLock, togglePortageLeg } from '../planner/tourRouteActions';
import type { TourPlannerController } from '../planner/useTourPlanner';
/** The paddle edits of the planner's waypoint rows, each one step of its history. */
export function usePaddleWaypointActions(planner: TourPlannerController) {
const { editPaddlePoints } = planner;
return {
togglePortage: useCallback(
(id: string) => editPaddlePoints((points) => togglePortageLeg(points, id)),
[editPaddlePoints]
),
setPortageExtra: useCallback(
(id: string, minutes: number | null) => editPaddlePoints((points) => setPortageExtraMinutes(points, id, minutes)),
[editPaddlePoints]
),
setLock: useCallback(
(id: string, lock: PaddleLock | null) => editPaddlePoints((points) => setWaypointLock(points, id, lock)),
[editPaddlePoints]
),
};
}