Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions __tests__/components/viewers/__snapshots__/stop-viewer.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ exports[`components > viewers > stop viewer should render countdown times after
From Location Icon
</title>
<path
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"
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"
fill="currentColor"
key="k0"
/>
Expand All @@ -390,7 +390,7 @@ exports[`components > viewers > stop viewer should render countdown times after
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
From here
Expand Down Expand Up @@ -471,7 +471,7 @@ exports[`components > viewers > stop viewer should render countdown times after
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
To here
Expand Down Expand Up @@ -1076,7 +1076,7 @@ exports[`components > viewers > stop viewer should render countdown times for st
From Location Icon
</title>
<path
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"
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"
fill="currentColor"
key="k0"
/>
Expand All @@ -1090,7 +1090,7 @@ exports[`components > viewers > stop viewer should render countdown times for st
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
From here
Expand Down Expand Up @@ -1171,7 +1171,7 @@ exports[`components > viewers > stop viewer should render countdown times for st
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
To here
Expand Down Expand Up @@ -1785,7 +1785,7 @@ exports[`components > viewers > stop viewer should render times after midnight w
From Location Icon
</title>
<path
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"
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"
fill="currentColor"
key="k0"
/>
Expand All @@ -1799,7 +1799,7 @@ exports[`components > viewers > stop viewer should render times after midnight w
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
From here
Expand Down Expand Up @@ -1880,7 +1880,7 @@ exports[`components > viewers > stop viewer should render times after midnight w
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
To here
Expand Down Expand Up @@ -2851,7 +2851,7 @@ exports[`components > viewers > stop viewer should render with OTP transit index
From Location Icon
</title>
<path
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"
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"
fill="currentColor"
key="k0"
/>
Expand All @@ -2865,7 +2865,7 @@ exports[`components > viewers > stop viewer should render with OTP transit index
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
From here
Expand Down Expand Up @@ -2946,7 +2946,7 @@ exports[`components > viewers > stop viewer should render with OTP transit index
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
To here
Expand Down Expand Up @@ -4651,7 +4651,7 @@ exports[`components > viewers > stop viewer should render with TriMet transit in
From Location Icon
</title>
<path
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"
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"
fill="currentColor"
key="k0"
/>
Expand All @@ -4665,7 +4665,7 @@ exports[`components > viewers > stop viewer should render with TriMet transit in
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
From here
Expand Down Expand Up @@ -4746,7 +4746,7 @@ exports[`components > viewers > stop viewer should render with TriMet transit in
onClick={[Function]}
>
<button
className="styled__Button-p56b41-2 XBKVp"
className="styled__Button-p56b41-2 bjZNPA"
onClick={[Function]}
>
To here
Expand Down
11 changes: 2 additions & 9 deletions lib/actions/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,8 @@ export function parseUrlQueryString (params = getUrlParams()) {
})
const searchId = params.ui_activeSearch || coreUtils.storage.randId()
// Convert strings to numbers/objects and dispatch
dispatch(
setQueryParam(
planParamsToQuery(
planParams,
getState().otp.config
),
searchId
)
)
planParamsToQuery(planParams, getState().otp.config)
.then(query => dispatch(setQueryParam(query, searchId)))
}
}

Expand Down
8 changes: 8 additions & 0 deletions lib/components/form/form.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@
font-size: 14px;
line-height: 1.4;
margin-top: -1px;
white-space: pre-wrap;
}

.otp .settings-preview .summary.tall {
line-height: 2.6;
}

.otp:not(.mobile) .settings-preview .summary {
/* Prevent overflow from being multi-line. 36px is edit button width. */
width: calc(100% - 36px);
}
Expand Down
19 changes: 15 additions & 4 deletions lib/components/form/settings-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import React, { Component } from 'react'
import { Button } from 'react-bootstrap'
import { connect } from 'react-redux'

import { mergeMessages } from '../../util/messages'

class SettingsPreview extends Component {
static propTypes = {
// component props
Expand All @@ -20,11 +22,15 @@ class SettingsPreview extends Component {
}

static defaultProps = {
editButtonText: <i className='fa fa-pencil' />
editButtonText: <i className='fa fa-pencil' />,
messages: {
label: 'Transit Options\n& Preferences'
}
}

render () {
const { config, query, caret, editButtonText } = this.props
const { caret, config, query, editButtonText } = this.props
const messages = mergeMessages(SettingsPreview.defaultProps, this.props)
// Show dot indicator if the current query differs from the default query.
let showDot = coreUtils.query.isNotDefaultQuery(query, config)
const button = (
Expand All @@ -35,10 +41,14 @@ class SettingsPreview extends Component {
{showDot && <div className='dot' />}
</div>
)

// Add tall class to account for vertical centering if there is only
// one line in the label (default is 2).
const addClass = messages.label.match(/\n/) ? '' : ' tall'
return (
<div className='settings-preview' onClick={this.props.onClick}>
<div className='summary'>Transit Options<br />&amp; Preferences</div>
<div className={`summary${addClass}`}>
{messages.label}
</div>
{button}
<div style={{ clear: 'both' }} />
</div>
Expand All @@ -49,6 +59,7 @@ class SettingsPreview extends Component {
const mapStateToProps = (state, ownProps) => {
return {
config: state.otp.config,
messages: state.otp.config.language.settingsPreview,
query: state.otp.currentQuery
}
}
Expand Down
15 changes: 15 additions & 0 deletions lib/util/messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Takes component's default props and its instance props and returns the
* merged messages props. The returned object will ensure that the default
* messages are substituted for any translation strings that were missing in the
* props. Note: this does not account for messages in nested objects (e.g.,
* messages.header.description).
*/
export function mergeMessages (defaultProps, props) {
const defaultMessages = defaultProps.messages || {}
const propsMessages = props.messages || {}
return {
...defaultMessages,
...propsMessages
}
}
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@
"dependencies": {
"@conveyal/lonlat": "^1.1.0",
"@mapbox/polyline": "^0.2.0",
"@opentripplanner/base-map": "^0.0.21",
"@opentripplanner/core-utils": "^0.0.21",
"@opentripplanner/endpoints-overlay": "^0.0.21",
"@opentripplanner/from-to-location-picker": "^0.0.21",
"@opentripplanner/geocoder": "^0.0.21",
"@opentripplanner/humanize-distance": "^0.0.21",
"@opentripplanner/icons": "^0.0.21",
"@opentripplanner/itinerary-body": "^0.0.21",
"@opentripplanner/location-field": "^0.0.21",
"@opentripplanner/location-icon": "^0.0.21",
"@opentripplanner/park-and-ride-overlay": "^0.0.21",
"@opentripplanner/printable-itinerary": "^0.0.21",
"@opentripplanner/route-viewer-overlay": "^0.0.21",
"@opentripplanner/stop-viewer-overlay": "^0.0.21",
"@opentripplanner/stops-overlay": "^0.0.21",
"@opentripplanner/transitive-overlay": "^0.0.21",
"@opentripplanner/trip-details": "^0.0.21",
"@opentripplanner/trip-form": "^0.0.21",
"@opentripplanner/trip-viewer-overlay": "^0.0.21",
"@opentripplanner/vehicle-rental-overlay": "^0.0.21",
"@opentripplanner/base-map": "^1.0.0",
"@opentripplanner/core-utils": "^1.2.0",
"@opentripplanner/endpoints-overlay": "1.0.0",
"@opentripplanner/from-to-location-picker": "^1.0.0",
"@opentripplanner/geocoder": "^1.0.2",
"@opentripplanner/humanize-distance": "^0.0.22",
"@opentripplanner/icons": "^1.0.0",
"@opentripplanner/itinerary-body": "^1.0.1",
"@opentripplanner/location-field": "^1.0.0",
"@opentripplanner/location-icon": "^1.0.0",
"@opentripplanner/park-and-ride-overlay": "^1.0.0",
"@opentripplanner/printable-itinerary": "^0.0.22",
"@opentripplanner/route-viewer-overlay": "^1.0.0",
"@opentripplanner/stop-viewer-overlay": "^1.0.0",
"@opentripplanner/stops-overlay": "^1.0.0",
"@opentripplanner/transitive-overlay": "^1.0.1",
"@opentripplanner/trip-details": "^1.1.0",
"@opentripplanner/trip-form": "^1.0.0",
"@opentripplanner/trip-viewer-overlay": "^1.0.0",
"@opentripplanner/vehicle-rental-overlay": "^1.0.0",
"@turf/along": "^6.0.1",
"bootstrap": "^3.3.7",
"bowser": "^1.9.3",
Expand Down Expand Up @@ -88,7 +88,7 @@
"redux-actions": "^1.2.1",
"redux-logger": "^2.7.4",
"redux-thunk": "^2.3.0",
"transitive-js": "^0.13.0",
"transitive-js": "^0.13.3",
"use-auth0-hooks": "^0.7.0",
"velocity-react": "^1.3.3"
},
Expand Down
Loading