mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
2c3b20bb57
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.
24 lines
985 B
TypeScript
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]
|
|
),
|
|
};
|
|
}
|