This commit is contained in:
Andras Schmelczer 2026-03-25 08:05:50 +00:00
parent c997ea46a5
commit 30055ab870
13 changed files with 165 additions and 83 deletions

View file

@ -82,7 +82,9 @@ export function useMapData({
// Build the travel param string from entries with destinations.
// Format: mode:slug[:best][:min:max] — server filters rows outside [min,max].
// When excludeFieldKey is set, that entry's time range is omitted (for drag preview).
// When excludeFieldKey is set, that entry uses a wide range (0:1440) instead of
// the committed range. This still filters out rows with no travel data (the server
// skips rows where minutes=None when any range is set) while including all actual values.
const buildTravelParam = useCallback(
(excludeFieldKey?: string): string => {
const segments: string[] = [];
@ -91,7 +93,11 @@ export function useMapData({
let seg = `${entry.mode}:${entry.slug}`;
if (entry.useBest) seg += ':best';
const isExcluded = excludeFieldKey === `tt_${entry.mode}_${entry.slug}`;
if (entry.timeRange && !isExcluded) seg += `:${entry.timeRange[0]}:${entry.timeRange[1]}`;
if (isExcluded) {
seg += ':0:1440';
} else if (entry.timeRange) {
seg += `:${entry.timeRange[0]}:${entry.timeRange[1]}`;
}
segments.push(seg);
}
return segments.join('|');

View file

@ -7,6 +7,8 @@ export interface Destination {
slug: string;
place_type: string;
city?: string;
lat: number;
lon: number;
}
/** Fetches all travel-time destinations for a mode once, with client-side caching. */