diff --git a/example-config.yml b/example-config.yml index 1369a6d2f..a7e100230 100644 --- a/example-config.yml +++ b/example-config.yml @@ -184,6 +184,9 @@ map: # geocoder test account can be obtained from the Pelias maintainers at geocode.earth. geocoder: apiKey: PELIAS_API_KEY + # Pass an array of geocoder result types to control the order in which they are displayed. + # The default order is ['STATIONS', 'STOPS', 'OTHER']. + geocoderResultsOrder: ['STATIONS', 'STOPS', 'OTHER'] boundary: rect: minLon: -123.2034 diff --git a/lib/components/app/batch-routing-panel.tsx b/lib/components/app/batch-routing-panel.tsx index 6ca1f6da2..30001e1b3 100644 --- a/lib/components/app/batch-routing-panel.tsx +++ b/lib/components/app/batch-routing-panel.tsx @@ -25,6 +25,7 @@ import ViewerContainer from '../viewers/viewer-container' interface Props { activeSearch: any currentQuery: any + geocoderResultsOrder?: Array intl: IntlShape mainPanelContent: number mobile?: boolean @@ -89,7 +90,13 @@ class BatchRoutingPanel extends Component { } render() { - const { activeSearch, intl, mobile, showUserSettings } = this.props + const { + activeSearch, + geocoderResultsOrder, + intl, + mobile, + showUserSettings + } = this.props const { planTripClicked } = this.state const mapAction = mobile ? intl.formatMessage({ @@ -157,6 +164,7 @@ class BatchRoutingPanel extends Component {
{ showClearButton={!mobile} /> { const { mainPanelContent } = state.otp.ui const currentQuery = state.otp.currentQuery + const geocoderResultsOrder = state.otp.config?.geocoder?.geocoderResultsOrder return { activeSearch: getActiveSearch(state), currentQuery, + geocoderResultsOrder, mainPanelContent, showUserSettings } diff --git a/lib/components/mobile/batch-search-screen.tsx b/lib/components/mobile/batch-search-screen.tsx index 04e2a850c..47bff6735 100644 --- a/lib/components/mobile/batch-search-screen.tsx +++ b/lib/components/mobile/batch-search-screen.tsx @@ -47,6 +47,7 @@ const MobileSearchSettings = styled.div<{ interface Props { currentQuery: any + geocoderResultsOrder: Array intl: IntlShape map: React.ReactElement routingQuery: any @@ -92,7 +93,7 @@ class BatchSearchScreen extends Component { } render() { - const { intl } = this.props + const { geocoderResultsOrder, intl } = this.props const { planTripClicked, showAdvancedModeSettings } = this.state const transitionDelay = this.state.closeAdvancedSettingsWithDelay ? 300 : 0 @@ -127,6 +128,7 @@ class BatchSearchScreen extends Component { style={{ display: 'content' }} > { showClearButton={false} /> { const mapStateToProps = (state: any) => { const currentQuery = state.otp.currentQuery + const { geocoderResultsOrder } = state.otp.config.geocoder return { - currentQuery + currentQuery, + geocoderResultsOrder } } diff --git a/lib/components/mobile/welcome-screen.tsx b/lib/components/mobile/welcome-screen.tsx index 9a3492407..8fde116df 100644 --- a/lib/components/mobile/welcome-screen.tsx +++ b/lib/components/mobile/welcome-screen.tsx @@ -12,10 +12,14 @@ import MobileContainer from './container' import MobileNavigationBar from './navigation-bar' interface Props { + geocoderResultsOrder: Array setMobileScreen: (screen: number) => void } -const MobileWelcomeScreen = ({ setMobileScreen }: Props) => { +const MobileWelcomeScreen = ({ + geocoderResultsOrder, + setMobileScreen +}: Props) => { const intl = useIntl() const toFieldClicked = useCallback( @@ -33,6 +37,7 @@ const MobileWelcomeScreen = ({ setMobileScreen }: Props) => {
{ + const { geocoderResultsOrder } = state.otp.config.geocoder + + return { + geocoderResultsOrder + } +} + +export default connect(mapStateToProps, mapDispatchToProps)(MobileWelcomeScreen) diff --git a/package.json b/package.json index 9fd7d7e60..79c052fed 100644 --- a/package.json +++ b/package.json @@ -50,10 +50,10 @@ "@opentripplanner/geocoder": "^3.0.2", "@opentripplanner/humanize-distance": "^1.2.0", "@opentripplanner/icons": "3.0.1", + "@opentripplanner/location-field": "3.1.1", "@opentripplanner/itinerary-body": "6.1.0", - "@opentripplanner/location-field": "3.0.0", "@opentripplanner/location-icon": "^1.4.1", - "@opentripplanner/map-popup": "5.1.0", + "@opentripplanner/map-popup": "5.1.1", "@opentripplanner/otp2-tile-overlay": "2.1.1", "@opentripplanner/park-and-ride-overlay": "3.0.0", "@opentripplanner/printable-itinerary": "3.0.0", diff --git a/yarn.lock b/yarn.lock index ea6fc03ed..1c1df6718 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2578,6 +2578,11 @@ react-resize-detector "^4.2.1" string-similarity "^4.0.4" +"@opentripplanner/location-field@3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@opentripplanner/location-field/-/location-field-3.1.1.tgz#0658df4cfd47866153c8ae33fd60e991cdf94df0" + integrity sha512-Q9yhi3AVlnj8izrpJvxN+uVBjjtEDyFXUsJ0VhE9zevVpGzCh/gcGNzJY5EnP2IRDd/Szx6dPUogt3XJlHkHTQ== + "@opentripplanner/itinerary-body@^6.0.0": version "6.0.3" resolved "https://registry.yarnpkg.com/@opentripplanner/itinerary-body/-/itinerary-body-6.0.3.tgz#84573d20ac9cc1fc7f2d2e032fac5a072ac3e142" @@ -2595,14 +2600,9 @@ react-animate-height "^3.0.4" react-resize-detector "^4.2.1" string-similarity "^4.0.4" - -"@opentripplanner/location-field@3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@opentripplanner/location-field/-/location-field-3.0.0.tgz#a6f8743290cf088bcd589cf8e6b0d07a651b704a" - integrity sha512-wPb9l5pvSeocZ45K1E3Zeb4hDjJtP9tw/S0MQ3HXYEQSf+700n4CWXVXYReYJXJYriOzge5/2whjUPGTlJckWw== dependencies: "@conveyal/geocoder-arcgis-geojson" "^0.0.3" - "@opentripplanner/core-utils" "^11.4.4" + "@opentripplanner/core-utils" "^12.0.0" "@opentripplanner/geocoder" "^3.0.2" "@opentripplanner/humanize-distance" "^1.2.0" "@opentripplanner/location-icon" "^1.4.1" @@ -2617,10 +2617,10 @@ "@styled-icons/fa-regular" "^10.34.0" "@styled-icons/fa-solid" "^10.34.0" -"@opentripplanner/map-popup@5.1.0", "@opentripplanner/map-popup@^v5.1.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@opentripplanner/map-popup/-/map-popup-5.1.0.tgz#cf6374bf7b69af69c026ec414a84719078c56e9e" - integrity sha512-EShoMyFZa7Zb2ZZrJhEsJfuCAvs2jfQe5QstU+AEk5Jm1zc8LzU6PsXmizQ/RMVi6zIYLhlBoZ3u458tTA3VQA== +"@opentripplanner/map-popup@5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@opentripplanner/map-popup/-/map-popup-5.1.1.tgz#f4699b63a2ba0fae6263f2417c5b85f5ffc204cb" + integrity sha512-HifqZFmrBy3FmARVKZwUnad8U/L8ftBm2PcSck4oGQ768E7TKhqyzXz+GzkO39TyKNU5yiNgmQEbss8elZuJ/g== dependencies: "@opentripplanner/base-map" "^4.0.0" "@opentripplanner/building-blocks" "^2.0.0" @@ -2639,6 +2639,17 @@ "@opentripplanner/from-to-location-picker" "^2.1.14" flat "^5.0.2" +"@opentripplanner/map-popup@^v5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@opentripplanner/map-popup/-/map-popup-5.1.0.tgz#cf6374bf7b69af69c026ec414a84719078c56e9e" + integrity sha512-EShoMyFZa7Zb2ZZrJhEsJfuCAvs2jfQe5QstU+AEk5Jm1zc8LzU6PsXmizQ/RMVi6zIYLhlBoZ3u458tTA3VQA== + dependencies: + "@opentripplanner/base-map" "^4.0.0" + "@opentripplanner/building-blocks" "^2.0.0" + "@opentripplanner/core-utils" "^12.0.0" + "@opentripplanner/from-to-location-picker" "^3.0.0" + flat "^5.0.2" + "@opentripplanner/otp2-tile-overlay@2.1.1": version "2.1.1" resolved "https://registry.yarnpkg.com/@opentripplanner/otp2-tile-overlay/-/otp2-tile-overlay-2.1.1.tgz#3bd2f26caa01181eb4ca90bbd05ce784f9b05a7a"