From 04a8eb43eead686c0e32255965f6e573c5ffcbfa Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Fri, 21 Nov 2025 21:22:33 +0100 Subject: feat: Enhance shape retrieval with bus and stop point indexing; update related components --- src/frontend/app/components/StopMapSheet.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/frontend/app/components/StopMapSheet.tsx') diff --git a/src/frontend/app/components/StopMapSheet.tsx b/src/frontend/app/components/StopMapSheet.tsx index 7dab82b..d70fcb6 100644 --- a/src/frontend/app/components/StopMapSheet.tsx +++ b/src/frontend/app/components/StopMapSheet.tsx @@ -19,6 +19,7 @@ export interface ConsolidatedCirculationForMap { line: string; route: string; currentPosition?: Position; + stopShapeIndex?: number; schedule?: { shapeId?: string; }; @@ -61,9 +62,14 @@ export const StopMap: React.FC = ({ ) { const key = `${c.schedule.shapeId}_${c.currentPosition.shapeIndex}`; if (!shapes[key]) { - fetch( - `${regionConfig.shapeEndpoint}?shapeId=${c.schedule.shapeId}&startPointIndex=${c.currentPosition.shapeIndex}` - ) + let url = `${regionConfig.shapeEndpoint}?shapeId=${c.schedule.shapeId}&busShapeIndex=${c.currentPosition.shapeIndex}`; + if (c.stopShapeIndex !== undefined) { + url += `&stopShapeIndex=${c.stopShapeIndex}`; + } else { + url += `&stopLat=${stop.latitude}&stopLon=${stop.longitude}`; + } + + fetch(url) .then((res) => { if (res.ok) return res.json(); return null; -- cgit v1.3