diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-11-21 21:22:33 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-11-21 21:22:33 +0100 |
| commit | 04a8eb43eead686c0e32255965f6e573c5ffcbfa (patch) | |
| tree | 95defdcdbb7e1fccbfaa2534ac959b99b8b4b54a /src/frontend/app/components/StopMapSheet.tsx | |
| parent | a08d0262115dfebdd11141df8a9b4204d0456dfa (diff) | |
feat: Enhance shape retrieval with bus and stop point indexing; update related components
Diffstat (limited to 'src/frontend/app/components/StopMapSheet.tsx')
| -rw-r--r-- | src/frontend/app/components/StopMapSheet.tsx | 12 |
1 files changed, 9 insertions, 3 deletions
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<StopMapProps> = ({ ) { 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; |
