From b2ddc0ef449ccbe7f0d33e539ccdfc1baef04e2c Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Sun, 28 Dec 2025 18:21:17 +0100 Subject: Get favourite stops from OTP instead of pre-generated file --- src/frontend/app/components/PlannerOverlay.tsx | 9 +++++---- src/frontend/app/components/StopGalleryItem.tsx | 11 ++++++++--- src/frontend/app/components/StopItem.tsx | 11 ++++++++--- src/frontend/app/components/stop/StopMapModal.tsx | 1 + 4 files changed, 22 insertions(+), 10 deletions(-) (limited to 'src/frontend/app/components') diff --git a/src/frontend/app/components/PlannerOverlay.tsx b/src/frontend/app/components/PlannerOverlay.tsx index 55e52d7..0320d45 100644 --- a/src/frontend/app/components/PlannerOverlay.tsx +++ b/src/frontend/app/components/PlannerOverlay.tsx @@ -110,10 +110,11 @@ export const PlannerOverlay: React.FC = ({ useEffect(() => { // Load favourites once; used as local suggestions in the picker. - StopDataProvider.getStops() - .then((stops) => - stops - .filter((s) => s.favourite && s.latitude && s.longitude) + const favouriteIds = StopDataProvider.getFavouriteIds(); + StopDataProvider.fetchStopsByIds(favouriteIds) + .then((stopsMap) => + Object.values(stopsMap) + .filter((s) => s.latitude && s.longitude) .map( (s) => ({ diff --git a/src/frontend/app/components/StopGalleryItem.tsx b/src/frontend/app/components/StopGalleryItem.tsx index bf60697..de369d8 100644 --- a/src/frontend/app/components/StopGalleryItem.tsx +++ b/src/frontend/app/components/StopGalleryItem.tsx @@ -26,7 +26,7 @@ const StopGalleryItem: React.FC = ({ stop }) => { )} - ({stop.stopId}) + ({stop.stopCode || stop.stopId})
= ({ stop }) => { {StopDataProvider.getDisplayName(stop)}
- {stop.lines?.slice(0, 5).map((line) => ( - + {stop.lines?.slice(0, 5).map((lineObj) => ( + ))} {stop.lines && stop.lines.length > 5 && ( diff --git a/src/frontend/app/components/StopItem.tsx b/src/frontend/app/components/StopItem.tsx index 9679b05..391e605 100644 --- a/src/frontend/app/components/StopItem.tsx +++ b/src/frontend/app/components/StopItem.tsx @@ -20,12 +20,17 @@ const StopItem: React.FC = ({ stop }) => { {StopDataProvider.getDisplayName(stop)} - ({stop.stopId}) + ({stop.stopCode || stop.stopId})
- {stop.lines?.map((line) => ( - + {stop.lines?.map((lineObj) => ( + ))}
diff --git a/src/frontend/app/components/stop/StopMapModal.tsx b/src/frontend/app/components/stop/StopMapModal.tsx index 757411e..688ec2e 100644 --- a/src/frontend/app/components/stop/StopMapModal.tsx +++ b/src/frontend/app/components/stop/StopMapModal.tsx @@ -1,3 +1,4 @@ +import maplibregl from "maplibre-gl"; import React, { useCallback, useEffect, -- cgit v1.3