-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into cleanup-duplicate-headsigns
- Loading branch information
Showing
25 changed files
with
33,906 additions
and
15,044 deletions.
There are no files selected for viewing
47,874 changes: 33,362 additions & 14,512 deletions
47,874
__tests__/components/viewers/__snapshots__/nearby-view.js.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ComponentType, HTMLAttributes } from 'react' | ||
import { connect } from 'react-redux' | ||
|
||
import { AppReduxState } from '../../util/state-types' | ||
import { combineQueryParams } from '../../util/api' | ||
import { isBlank } from '../../util/ui' | ||
|
||
interface OwnProps extends HTMLAttributes<HTMLAnchorElement> { | ||
to: string | ||
toParams?: Record<string, unknown> | ||
} | ||
|
||
/** | ||
* Renders an anchor element <a> with specified path and query params, | ||
* that preserves other existing query params. | ||
*/ | ||
const Link: ComponentType = 'a' as unknown as ComponentType | ||
|
||
// connect to the redux store so that the search params get updated in timely fashion. | ||
|
||
const mapStateToProps = (state: AppReduxState, ownProps: OwnProps) => { | ||
const queryParams = combineQueryParams(ownProps.toParams) | ||
const href = `#${ownProps.to}${isBlank(queryParams) ? '' : `?${queryParams}`}` | ||
return { | ||
href, | ||
// Remove the passed to and toParams props from the rendered HTML. | ||
to: undefined, | ||
toParams: undefined | ||
} | ||
} | ||
|
||
// Pass an empty object as mapDispatchToProps to remove dispatch from the rendered HTML. | ||
export default connect(mapStateToProps, {})(Link) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { connect } from 'react-redux' | ||
import { Place } from '@opentripplanner/types' | ||
import FromToLocationPicker from '@opentripplanner/from-to-location-picker' | ||
import React, { useCallback, useMemo } from 'react' | ||
|
||
import * as mapActions from '../../../actions/map' | ||
import { SetLocationHandler } from '../../util/types' | ||
|
||
interface Props { | ||
className?: string | ||
place: Place | ||
setLocation: SetLocationHandler | ||
} | ||
|
||
const FromToPicker = ({ className, place, setLocation }: Props) => { | ||
const location = useMemo( | ||
() => ({ | ||
lat: place.lat ?? 0, | ||
lon: place.lon ?? 0, | ||
name: place.name | ||
}), | ||
[place] | ||
) | ||
return ( | ||
<span className={className} role="group"> | ||
<FromToLocationPicker | ||
label | ||
onFromClick={useCallback(() => { | ||
setLocation({ location, locationType: 'from', reverseGeocode: false }) | ||
}, [location, setLocation])} | ||
onToClick={useCallback(() => { | ||
setLocation({ location, locationType: 'to', reverseGeocode: false }) | ||
}, [location, setLocation])} | ||
/> | ||
</span> | ||
) | ||
} | ||
|
||
const mapDispatchToProps = { | ||
setLocation: mapActions.setLocation | ||
} | ||
|
||
export default connect(null, mapDispatchToProps)(FromToPicker) |
Oops, something went wrong.