Skip to content

Commit

Permalink
fix: proper near you mode validation
Browse files Browse the repository at this point in the history
  • Loading branch information
vesameskanen committed Nov 18, 2022
1 parent 96026d4 commit 2dd0f30
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digitransit-component/digitransit-component-control-panel",
"version": "1.1.0",
"version": "1.1.1",
"description": "digitransit-component control-panel module",
"main": "index.js",
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ BubbleDialog.propTypes = {
*
*/

const validNearYouModes = [
'favorite',
'bus',
'tram',
'rail',
'subway',
'airplane',
'ferry',
'citybike',
];

function getIconName(mode, modeSet) {
return modeSet === 'default' ? `mode-${mode}` : `mode-${modeSet}-${mode}`;
}
Expand Down Expand Up @@ -218,7 +229,7 @@ function NearStopsAndRoutes({
urlStart = urlParts.join('/');
}
const buttons = modeArray
.filter(mode => mode !== 'funicular')
.filter(mode => validNearYouModes.includes(mode))
.map(mode => {
const withAlert = modesWithAlerts.includes(mode.toUpperCase());
let url = `${urlStart}/${mode.toUpperCase()}/POS`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@digitransit-component/digitransit-component-autosuggest": "^1.9.2",
"@digitransit-component/digitransit-component-autosuggest-panel": "^1.5.3",
"@digitransit-component/digitransit-component-control-panel": "^1.1.0",
"@digitransit-component/digitransit-component-control-panel": "^1.1.1",
"@digitransit-component/digitransit-component-favourite-bar": "1.1.0",
"@digitransit-component/digitransit-component-favourite-editing-modal": "^1.1.0",
"@digitransit-component/digitransit-component-favourite-modal": "^0.4.0",
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ __metadata:
languageName: unknown
linkType: soft

"@digitransit-component/digitransit-component-control-panel@^1.1.0, @digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel":
"@digitransit-component/digitransit-component-control-panel@^1.1.1, @digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel":
version: 0.0.0-use.local
resolution: "@digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel"
peerDependencies:
Expand Down Expand Up @@ -2188,7 +2188,7 @@ __metadata:
dependencies:
"@digitransit-component/digitransit-component-autosuggest": ^1.9.2
"@digitransit-component/digitransit-component-autosuggest-panel": ^1.5.3
"@digitransit-component/digitransit-component-control-panel": ^1.1.0
"@digitransit-component/digitransit-component-control-panel": ^1.1.1
"@digitransit-component/digitransit-component-favourite-bar": 1.1.0
"@digitransit-component/digitransit-component-favourite-editing-modal": ^1.1.0
"@digitransit-component/digitransit-component-favourite-modal": ^0.4.0
Expand Down

0 comments on commit 2dd0f30

Please sign in to comment.