Skip to content

Commit

Permalink
Merge pull request #5062 from HSLdevcom/DT-5934
Browse files Browse the repository at this point in the history
DT-5934 Minimum transfertime option
  • Loading branch information
vesameskanen authored Sep 6, 2024
2 parents df31b06 + aa478c5 commit b3a08c0
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/component/itinerary/CustomizeSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import FareZoneSelector from './customizesearch/FareZoneSelector';
import StreetModeSelectorPanel from './customizesearch/StreetModeSelectorPanel';
import TransportModesSection from './customizesearch/TransportModesSection';
import WalkingOptionsSection from './customizesearch/WalkingOptionsSection';
import MinTransferTimeSection from './customizesearch/MinTransferTimeSection';
import AccessibilityOptionSection from './customizesearch/AccessibilityOptionSection';
import TransferOptionsSection from './customizesearch/TransferOptionsSection';
import RentalNetworkSelector from './customizesearch/RentalNetworkSelector';
Expand Down Expand Up @@ -128,6 +129,13 @@ class CustomizeSearch extends React.Component {
<TransportModesSection config={config} />
</div>
)}
{config.minTransferTimeSelection && (
<MinTransferTimeSection
minTransferTimeOptions={config.minTransferTimeSelection}
currentSettings={currentSettings}
defaultSettings={this.defaultSettings}
/>
)}
<div className="settings-option-container">
<TransferOptionsSection
defaultSettings={this.defaultSettings}
Expand Down
52 changes: 52 additions & 0 deletions app/component/itinerary/customizesearch/MinTransferTimeSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import PropTypes from 'prop-types';
import React from 'react';
import { intlShape } from 'react-intl';
import { saveRoutingSettings } from '../../../action/SearchSettingsActions';
import { settingsShape, minTransferTimeShape } from '../../../util/shapes';
import { addAnalyticsEvent } from '../../../util/analyticsUtils';
import SearchSettingsDropdown from './SearchSettingsDropdown';

const MinTransferTimeSection = (
{ currentSettings, defaultSettings, minTransferTimeOptions },
{ intl, executeAction },
options = minTransferTimeOptions,
currentSelection = options.find(
option => option.value === currentSettings.minTransferTime,
),
) => (
<div className="walk-options-container">
<SearchSettingsDropdown
currentSelection={currentSelection}
defaultValue={defaultSettings.minTransferTime}
onOptionSelected={value => {
executeAction(saveRoutingSettings, {
minTransferTime: value,
});
addAnalyticsEvent({
category: 'ItinerarySettings',
action: 'ChangeMinTransferTime',
name: value,
});
}}
options={options}
labelText={intl.formatMessage({ id: 'min-transfer-time' })}
highlightDefaulValue
formatOptions
name="minTransferTime"
translateLabels={false}
/>
</div>
);

MinTransferTimeSection.propTypes = {
defaultSettings: settingsShape.isRequired,
minTransferTimeOptions: minTransferTimeShape.isRequired,
currentSettings: settingsShape.isRequired,
};

MinTransferTimeSection.contextTypes = {
intl: intlShape.isRequired,
executeAction: PropTypes.func.isRequired,
};

export default MinTransferTimeSection;
27 changes: 27 additions & 0 deletions app/configurations/config.matka.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,31 @@ export default {
includePublicWithBikePlan: true,

startSearchFromUserLocation: true,

minTransferTimeSelection: [
{
title: '1.5 min',
value: 90,
},
{
title: '3 min',
value: 180,
},
{
title: '5 min',
value: 300,
},
{
title: '7 min',
value: 420,
},
{
title: '10 min',
value: 600,
},
{
title: '30 min',
value: 1800,
},
],
};
23 changes: 23 additions & 0 deletions app/configurations/config.waltti.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,27 @@ export default {
},

startSearchFromUserLocation: true,

minTransferTimeSelection: [
{
title: '1.5 min',
value: 90,
},
{
title: '3 min',
value: 180,
},
{
title: '5 min',
value: 300,
},
{
title: '7 min',
value: 420,
},
{
title: '10 min',
value: 600,
},
],
};
3 changes: 3 additions & 0 deletions app/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,7 @@ const translations = {
'menu-link-to-privacy-policy': 'Privacy policy',
'messagebar-label-close-message-bar': 'Close banner',
'messagebar-label-page': 'Page',
'min-transfer-time': 'Interchange time',
'minute-short': 'min',
minutes: 'min',
'minutes-or-route': 'Min / Route',
Expand Down Expand Up @@ -2476,6 +2477,7 @@ const translations = {
'menu-link-to-privacy-policy': 'Rekisteriseloste',
'messagebar-label-close-message-bar': 'Sulje banneri',
'messagebar-label-page': 'Sivu',
'min-transfer-time': 'Vaihtoaika',
'minute-short': 'min',
minutes: 'min',
'minutes-or-route': 'Min / Linja',
Expand Down Expand Up @@ -5336,6 +5338,7 @@ const translations = {
'menu-link-to-privacy-policy': 'Registerbeskrivning',
'messagebar-label-close-message-bar': 'Stäng banner',
'messagebar-label-page': 'Sidan',
'min-transfer-time': 'Bytestid',
'minute-short': 'min',
minutes: 'min',
'minutes-or-route': 'Min / Linje',
Expand Down
7 changes: 7 additions & 0 deletions app/util/shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,10 @@ export const vehicleShape = PropTypes.shape({
heading: PropTypes.number,
headsign: PropTypes.string,
});

export const minTransferTimeShape = PropTypes.arrayOf(
PropTypes.shape({
title: PropTypes.string,
value: PropTypes.number,
}),
);

0 comments on commit b3a08c0

Please sign in to comment.