Skip to content

Commit 3fa82f8

Browse files
committed
refactor: address PR comments
see #100
1 parent bd9e51c commit 3fa82f8

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Diff for: lib/components/app/responsive-webapp.js

+3
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ class RouterWrapper extends Component {
194194
<Route
195195
path='/print'
196196
component={(routerProps) => {
197+
// combine the router props with the other props that get
198+
// passed to the exported component. This way it's possible for
199+
// the PrintLayout component to receive the custom icons prop.
197200
const props = {...this.props, ...routerProps}
198201
return <PrintLayout {...props} />
199202
}}

Diff for: lib/components/narrative/line-itin/access-leg-body.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class AccessLegSummary extends Component {
163163
<div>
164164
{getLegModeLabel(leg)}
165165
{' '}
166-
{leg.distance && <span> {distanceString(leg.distance)}</span>}
166+
{leg.distance > 0 && <span> {distanceString(leg.distance)}</span>}
167167
{` to ${getPlaceName(leg.to, config.companies)}`}
168168
</div>
169169
</div>

Diff for: lib/util/itinerary.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ export function toSentenceCase (str) {
379379
*/
380380
export function getLegIcon (leg, customIcons) {
381381
// check if a custom function exists for determining the icon for a leg
382-
if (typeof customIcons.customIconForLeg === 'function') {
382+
if (customIcons && typeof customIcons.customIconForLeg === 'function') {
383383
// function exits, get the icon string lookup. It's possible for there to be
384384
// a custom function that only returns a string for when a leg meets the
385385
// criteria of the custom function
@@ -406,7 +406,7 @@ export function getLegIcon (leg, customIcons) {
406406
* Get the configured company object for the given network string if the company
407407
* has been defined in the provided companies array config.
408408
*/
409-
export function getCompanyForNetwork (networkString, companies = []) {
409+
function getCompanyForNetwork (networkString, companies = []) {
410410
const company = companies.find(co => co.id === networkString)
411411
if (!company) {
412412
console.warn(`No company found in config.yml that matches rented vehicle network: ${networkString}`, companies)

0 commit comments

Comments
 (0)