Skip to content

Commit

Permalink
Fix a non appearing popup in map search
Browse files Browse the repository at this point in the history
  • Loading branch information
solita-sabinaf committed Sep 16, 2024
1 parent f169451 commit de0fb76
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ext/JourneyPatternStopPointMap/Popovers/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 };
}
Expand Down Expand Up @@ -74,12 +73,13 @@ const SearchResult = ({
<TertiarySquareButton
onClick={() => {
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 = {
Expand Down

0 comments on commit de0fb76

Please sign in to comment.