Skip to content

Commit d5cd66f

Browse files
authored
Merge pull request #194 from opentripplanner/dev-master-conflicts
Resolve dev->master conflicts
2 parents bedfa48 + 30d4666 commit d5cd66f

File tree

7 files changed

+241
-166
lines changed

7 files changed

+241
-166
lines changed

Diff for: __tests__/components/viewers/__snapshots__/stop-viewer.js.snap

+15-15
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ exports[`components > viewers > stop viewer should render countdown times after
376376
From Location Icon
377377
</title>
378378
<path
379-
d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm80 248c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80z"
379+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
380380
fill="currentColor"
381381
key="k0"
382382
/>
@@ -390,7 +390,7 @@ exports[`components > viewers > stop viewer should render countdown times after
390390
onClick={[Function]}
391391
>
392392
<button
393-
className="styled__Button-p56b41-2 XBKVp"
393+
className="styled__Button-p56b41-2 bjZNPA"
394394
onClick={[Function]}
395395
>
396396
From here
@@ -471,7 +471,7 @@ exports[`components > viewers > stop viewer should render countdown times after
471471
onClick={[Function]}
472472
>
473473
<button
474-
className="styled__Button-p56b41-2 XBKVp"
474+
className="styled__Button-p56b41-2 bjZNPA"
475475
onClick={[Function]}
476476
>
477477
To here
@@ -1076,7 +1076,7 @@ exports[`components > viewers > stop viewer should render countdown times for st
10761076
From Location Icon
10771077
</title>
10781078
<path
1079-
d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm80 248c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80z"
1079+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
10801080
fill="currentColor"
10811081
key="k0"
10821082
/>
@@ -1090,7 +1090,7 @@ exports[`components > viewers > stop viewer should render countdown times for st
10901090
onClick={[Function]}
10911091
>
10921092
<button
1093-
className="styled__Button-p56b41-2 XBKVp"
1093+
className="styled__Button-p56b41-2 bjZNPA"
10941094
onClick={[Function]}
10951095
>
10961096
From here
@@ -1171,7 +1171,7 @@ exports[`components > viewers > stop viewer should render countdown times for st
11711171
onClick={[Function]}
11721172
>
11731173
<button
1174-
className="styled__Button-p56b41-2 XBKVp"
1174+
className="styled__Button-p56b41-2 bjZNPA"
11751175
onClick={[Function]}
11761176
>
11771177
To here
@@ -1785,7 +1785,7 @@ exports[`components > viewers > stop viewer should render times after midnight w
17851785
From Location Icon
17861786
</title>
17871787
<path
1788-
d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm80 248c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80z"
1788+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
17891789
fill="currentColor"
17901790
key="k0"
17911791
/>
@@ -1799,7 +1799,7 @@ exports[`components > viewers > stop viewer should render times after midnight w
17991799
onClick={[Function]}
18001800
>
18011801
<button
1802-
className="styled__Button-p56b41-2 XBKVp"
1802+
className="styled__Button-p56b41-2 bjZNPA"
18031803
onClick={[Function]}
18041804
>
18051805
From here
@@ -1880,7 +1880,7 @@ exports[`components > viewers > stop viewer should render times after midnight w
18801880
onClick={[Function]}
18811881
>
18821882
<button
1883-
className="styled__Button-p56b41-2 XBKVp"
1883+
className="styled__Button-p56b41-2 bjZNPA"
18841884
onClick={[Function]}
18851885
>
18861886
To here
@@ -2851,7 +2851,7 @@ exports[`components > viewers > stop viewer should render with OTP transit index
28512851
From Location Icon
28522852
</title>
28532853
<path
2854-
d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm80 248c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80z"
2854+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
28552855
fill="currentColor"
28562856
key="k0"
28572857
/>
@@ -2865,7 +2865,7 @@ exports[`components > viewers > stop viewer should render with OTP transit index
28652865
onClick={[Function]}
28662866
>
28672867
<button
2868-
className="styled__Button-p56b41-2 XBKVp"
2868+
className="styled__Button-p56b41-2 bjZNPA"
28692869
onClick={[Function]}
28702870
>
28712871
From here
@@ -2946,7 +2946,7 @@ exports[`components > viewers > stop viewer should render with OTP transit index
29462946
onClick={[Function]}
29472947
>
29482948
<button
2949-
className="styled__Button-p56b41-2 XBKVp"
2949+
className="styled__Button-p56b41-2 bjZNPA"
29502950
onClick={[Function]}
29512951
>
29522952
To here
@@ -4651,7 +4651,7 @@ exports[`components > viewers > stop viewer should render with TriMet transit in
46514651
From Location Icon
46524652
</title>
46534653
<path
4654-
d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm80 248c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80z"
4654+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
46554655
fill="currentColor"
46564656
key="k0"
46574657
/>
@@ -4665,7 +4665,7 @@ exports[`components > viewers > stop viewer should render with TriMet transit in
46654665
onClick={[Function]}
46664666
>
46674667
<button
4668-
className="styled__Button-p56b41-2 XBKVp"
4668+
className="styled__Button-p56b41-2 bjZNPA"
46694669
onClick={[Function]}
46704670
>
46714671
From here
@@ -4746,7 +4746,7 @@ exports[`components > viewers > stop viewer should render with TriMet transit in
47464746
onClick={[Function]}
47474747
>
47484748
<button
4749-
className="styled__Button-p56b41-2 XBKVp"
4749+
className="styled__Button-p56b41-2 bjZNPA"
47504750
onClick={[Function]}
47514751
>
47524752
To here

Diff for: lib/actions/form.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,8 @@ export function parseUrlQueryString (params = getUrlParams()) {
7070
})
7171
const searchId = params.ui_activeSearch || coreUtils.storage.randId()
7272
// Convert strings to numbers/objects and dispatch
73-
dispatch(
74-
setQueryParam(
75-
planParamsToQuery(
76-
planParams,
77-
getState().otp.config
78-
),
79-
searchId
80-
)
81-
)
73+
planParamsToQuery(planParams, getState().otp.config)
74+
.then(query => dispatch(setQueryParam(query, searchId)))
8275
}
8376
}
8477

Diff for: lib/components/form/form.css

+8
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@
126126
font-size: 14px;
127127
line-height: 1.4;
128128
margin-top: -1px;
129+
white-space: pre-wrap;
130+
}
131+
132+
.otp .settings-preview .summary.tall {
133+
line-height: 2.6;
134+
}
135+
136+
.otp:not(.mobile) .settings-preview .summary {
129137
/* Prevent overflow from being multi-line. 36px is edit button width. */
130138
width: calc(100% - 36px);
131139
}

Diff for: lib/components/form/settings-preview.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import React, { Component } from 'react'
44
import { Button } from 'react-bootstrap'
55
import { connect } from 'react-redux'
66

7+
import { mergeMessages } from '../../util/messages'
8+
79
class SettingsPreview extends Component {
810
static propTypes = {
911
// component props
@@ -20,11 +22,15 @@ class SettingsPreview extends Component {
2022
}
2123

2224
static defaultProps = {
23-
editButtonText: <i className='fa fa-pencil' />
25+
editButtonText: <i className='fa fa-pencil' />,
26+
messages: {
27+
label: 'Transit Options\n& Preferences'
28+
}
2429
}
2530

2631
render () {
27-
const { config, query, caret, editButtonText } = this.props
32+
const { caret, config, query, editButtonText } = this.props
33+
const messages = mergeMessages(SettingsPreview.defaultProps, this.props)
2834
// Show dot indicator if the current query differs from the default query.
2935
let showDot = coreUtils.query.isNotDefaultQuery(query, config)
3036
const button = (
@@ -35,10 +41,14 @@ class SettingsPreview extends Component {
3541
{showDot && <div className='dot' />}
3642
</div>
3743
)
38-
44+
// Add tall class to account for vertical centering if there is only
45+
// one line in the label (default is 2).
46+
const addClass = messages.label.match(/\n/) ? '' : ' tall'
3947
return (
4048
<div className='settings-preview' onClick={this.props.onClick}>
41-
<div className='summary'>Transit Options<br />&amp; Preferences</div>
49+
<div className={`summary${addClass}`}>
50+
{messages.label}
51+
</div>
4252
{button}
4353
<div style={{ clear: 'both' }} />
4454
</div>
@@ -49,6 +59,7 @@ class SettingsPreview extends Component {
4959
const mapStateToProps = (state, ownProps) => {
5060
return {
5161
config: state.otp.config,
62+
messages: state.otp.config.language.settingsPreview,
5263
query: state.otp.currentQuery
5364
}
5465
}

Diff for: lib/util/messages.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Takes component's default props and its instance props and returns the
3+
* merged messages props. The returned object will ensure that the default
4+
* messages are substituted for any translation strings that were missing in the
5+
* props. Note: this does not account for messages in nested objects (e.g.,
6+
* messages.header.description).
7+
*/
8+
export function mergeMessages (defaultProps, props) {
9+
const defaultMessages = defaultProps.messages || {}
10+
const propsMessages = props.messages || {}
11+
return {
12+
...defaultMessages,
13+
...propsMessages
14+
}
15+
}

Diff for: package.json

+21-21
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@
2929
"dependencies": {
3030
"@conveyal/lonlat": "^1.1.0",
3131
"@mapbox/polyline": "^0.2.0",
32-
"@opentripplanner/base-map": "^0.0.21",
33-
"@opentripplanner/core-utils": "^0.0.21",
34-
"@opentripplanner/endpoints-overlay": "^0.0.21",
35-
"@opentripplanner/from-to-location-picker": "^0.0.21",
36-
"@opentripplanner/geocoder": "^0.0.21",
37-
"@opentripplanner/humanize-distance": "^0.0.21",
38-
"@opentripplanner/icons": "^0.0.21",
39-
"@opentripplanner/itinerary-body": "^0.0.21",
40-
"@opentripplanner/location-field": "^0.0.21",
41-
"@opentripplanner/location-icon": "^0.0.21",
42-
"@opentripplanner/park-and-ride-overlay": "^0.0.21",
43-
"@opentripplanner/printable-itinerary": "^0.0.21",
44-
"@opentripplanner/route-viewer-overlay": "^0.0.21",
45-
"@opentripplanner/stop-viewer-overlay": "^0.0.21",
46-
"@opentripplanner/stops-overlay": "^0.0.21",
47-
"@opentripplanner/transitive-overlay": "^0.0.21",
48-
"@opentripplanner/trip-details": "^0.0.21",
49-
"@opentripplanner/trip-form": "^0.0.21",
50-
"@opentripplanner/trip-viewer-overlay": "^0.0.21",
51-
"@opentripplanner/vehicle-rental-overlay": "^0.0.21",
32+
"@opentripplanner/base-map": "^1.0.0",
33+
"@opentripplanner/core-utils": "^1.2.0",
34+
"@opentripplanner/endpoints-overlay": "1.0.0",
35+
"@opentripplanner/from-to-location-picker": "^1.0.0",
36+
"@opentripplanner/geocoder": "^1.0.2",
37+
"@opentripplanner/humanize-distance": "^0.0.22",
38+
"@opentripplanner/icons": "^1.0.0",
39+
"@opentripplanner/itinerary-body": "^1.0.1",
40+
"@opentripplanner/location-field": "^1.0.0",
41+
"@opentripplanner/location-icon": "^1.0.0",
42+
"@opentripplanner/park-and-ride-overlay": "^1.0.0",
43+
"@opentripplanner/printable-itinerary": "^0.0.22",
44+
"@opentripplanner/route-viewer-overlay": "^1.0.0",
45+
"@opentripplanner/stop-viewer-overlay": "^1.0.0",
46+
"@opentripplanner/stops-overlay": "^1.0.0",
47+
"@opentripplanner/transitive-overlay": "^1.0.1",
48+
"@opentripplanner/trip-details": "^1.1.0",
49+
"@opentripplanner/trip-form": "^1.0.0",
50+
"@opentripplanner/trip-viewer-overlay": "^1.0.0",
51+
"@opentripplanner/vehicle-rental-overlay": "^1.0.0",
5252
"@turf/along": "^6.0.1",
5353
"bootstrap": "^3.3.7",
5454
"bowser": "^1.9.3",
@@ -88,7 +88,7 @@
8888
"redux-actions": "^1.2.1",
8989
"redux-logger": "^2.7.4",
9090
"redux-thunk": "^2.3.0",
91-
"transitive-js": "^0.13.0",
91+
"transitive-js": "^0.13.3",
9292
"use-auth0-hooks": "^0.7.0",
9393
"velocity-react": "^1.3.3"
9494
},

0 commit comments

Comments
 (0)