aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/components/StopMapSheet.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/app/components/StopMapSheet.tsx')
-rw-r--r--src/frontend/app/components/StopMapSheet.tsx12
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;