Skip to content

Commit

Permalink
Merge pull request #5209 from HSLdevcom/DT-6590
Browse files Browse the repository at this point in the history
DT-6590 Prevent locationPopup during navimode
  • Loading branch information
vesameskanen authored Dec 20, 2024
2 parents d021588 + 981ea14 commit c087597
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/component/itinerary/ItineraryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,7 @@ export default function ItineraryPage(props, context) {
objectsToHide={objectsToHide}
itinerary={explicitItinerary}
showBackButton={!naviMode}
isLocationPopupEnabled={!naviMode}
/>
);
}
Expand Down
22 changes: 15 additions & 7 deletions app/component/map/ItineraryPageMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function ItineraryPageMap(
showDurationBubble,
itinerary,
showBackButton,
isLocationPopupEnabled,
...rest
},
{ match, router, executeAction, config },
Expand Down Expand Up @@ -99,13 +100,18 @@ function ItineraryPageMap(
leafletObjs.push(<LocationMarker key={`via_${i}`} position={via} />);
});

// max 5 viapoints
const locationPopup =
config.viaPointsEnabled && viaPoints.length < 5
? 'all'
: 'origindestination';
const onSelectLocation = (item, id) =>
onLocationPopup(item, id, router, match, executeAction);
let locationPopup = 'none';
let onSelectLocation;

if (isLocationPopupEnabled) {
// max 5 viapoints
locationPopup =
config.viaPointsEnabled && viaPoints.length < 5
? 'all'
: 'origindestination';
onSelectLocation = (item, id) =>
onLocationPopup(item, id, router, match, executeAction);
}

return (
<MapWithTracking
Expand Down Expand Up @@ -149,6 +155,7 @@ ItineraryPageMap.propTypes = {
showDurationBubble: PropTypes.bool,
itinerary: itineraryShape,
showBackButton: PropTypes.bool,
isLocationPopupEnabled: PropTypes.bool,
};

ItineraryPageMap.defaultProps = {
Expand All @@ -158,6 +165,7 @@ ItineraryPageMap.defaultProps = {
showDurationBubble: false,
itinerary: undefined,
showBackButton: true,
isLocationPopupEnabled: false,
};

ItineraryPageMap.contextTypes = {
Expand Down

0 comments on commit c087597

Please sign in to comment.