From de0fb76db02c496d5f6c6fd8389547b391e9277c Mon Sep 17 00:00:00 2001 From: Sabina Fataliyeva Date: Mon, 16 Sep 2024 19:49:19 +0300 Subject: [PATCH] Fix a non appearing popup in map search --- .../Popovers/SearchResult.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ext/JourneyPatternStopPointMap/Popovers/SearchResult.tsx b/src/ext/JourneyPatternStopPointMap/Popovers/SearchResult.tsx index fda2a990a..e39e8ba33 100644 --- a/src/ext/JourneyPatternStopPointMap/Popovers/SearchResult.tsx +++ b/src/ext/JourneyPatternStopPointMap/Popovers/SearchResult.tsx @@ -22,7 +22,7 @@ interface SearchResultProps { const determineQuayToFocus = ( searchText: string, stopPlace: StopPlace, - getSelectedQuayIdsCallback: (stopPlace: StopPlace) => string[], + selectedQuayIds: string[], ) => { const quayFullyMatchingSearch = stopPlace.quays.filter( (q) => q.id === searchText, @@ -41,9 +41,8 @@ const determineQuayToFocus = ( return { id: quayContainingSearch.id, type: JourneyPatternMarkerType.QUAY }; } - const selectedQuaysIds = getSelectedQuayIdsCallback(stopPlace); const firstSelectedQuayId = - selectedQuaysIds.length > 0 ? selectedQuaysIds[0] : undefined; + selectedQuayIds.length > 0 ? selectedQuayIds[0] : undefined; if (firstSelectedQuayId) { return { id: firstSelectedQuayId, type: JourneyPatternMarkerType.QUAY }; } @@ -74,12 +73,13 @@ const SearchResult = ({ { let focusedMarker: JourneyPatternMarker; - if (searchText.includes('Quay')) { + const selectedQuayIds = getSelectedQuayIdsCallback(stopPlace); + if (searchText.includes('Quay') || selectedQuayIds?.length > 0) { // Find the most suitable quayId to open the popup of focusedMarker = determineQuayToFocus( searchText, stopPlace, - getSelectedQuayIdsCallback, + selectedQuayIds, ); } else { focusedMarker = {