Auto-enable POI categories on routing profile change
useProfileDefaults hook observes profile changes in Yjs and merges relevant POI categories into the enabled set. Skips initial load to respect existing state. Cycling profiles → bike infra, hiking → shelter + viewpoints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
be36a5f650
commit
22c5ebd838
4 changed files with 51 additions and 4 deletions
|
|
@ -10,6 +10,7 @@ import { parseGpxAsync, extractWaypoints } from "@trails-cool/gpx";
|
|||
import { isOvernight } from "~/lib/overnight";
|
||||
import { setOvernight } from "~/lib/overnight";
|
||||
import { usePois } from "~/lib/use-pois";
|
||||
import { useProfileDefaults } from "~/lib/use-profile-defaults";
|
||||
import { snapToPoi } from "~/lib/poi-snap";
|
||||
import { Z_CURSOR, Z_WAYPOINT, Z_WAYPOINT_HIGHLIGHTED, Z_HIGHLIGHT } from "~/lib/z-index";
|
||||
import { NoGoAreaLayer } from "./NoGoAreaLayer";
|
||||
|
|
@ -278,6 +279,7 @@ export function PlannerMap({ yjs, onRouteRequest, highlightPosition, highlighted
|
|||
const { t } = useTranslation("planner");
|
||||
const [waypoints, setWaypoints] = useState<WaypointData[]>([]);
|
||||
const poiState = usePois();
|
||||
useProfileDefaults(yjs, poiState);
|
||||
const [draggingOver, setDraggingOver] = useState(false);
|
||||
const dragCounterRef = useRef(0);
|
||||
const [routeCoordinates, setRouteCoordinates] = useState<[number, number, number][] | null>(null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue