-
Notifications
You must be signed in to change notification settings - Fork 58
Improve save user locations #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
55c5f5b
feat(FavoriteLocationsPane): Add locations using LocationField.
binh-dam-ibigroup d13a712
refactor(FavoriteLocationsPane): Expand use of LocationField.
binh-dam-ibigroup ca1d279
refactor(FavoriteLocationsPane): Improve LocationField styling.
binh-dam-ibigroup 34f99bd
refactor(FavoriteLocationsPane): Extract FavoriteLocation component.
binh-dam-ibigroup a8f031d
refactor(FavoriteLocation): Convert component into full class.
binh-dam-ibigroup 150eba6
refactor(FavoriteLocation): Move event handling and state to inside c…
binh-dam-ibigroup 4b52498
refactor(FavoriteLocation): Tweak styles.
binh-dam-ibigroup 6960a1e
refactor(FavoriteLocation): Extract FavoriteLocation into file.
binh-dam-ibigroup 923b74d
refactor(FavoriteLocation): Tweak comments
binh-dam-ibigroup 6e2c0b9
refactor(connectLocationField): Encapsulate code to connect LocationF…
binh-dam-ibigroup 6221ab0
refactor(LocationField): refactor HOC for LocationField
landonreed 31ed484
Merge pull request #285 from opentripplanner/connect-location-field-ltr
binh-dam-ibigroup 95e1c9c
refactor(IntermediatePlaceField): Add back actions and unset location…
binh-dam-ibigroup 4cd86a3
refactor(FontAwesome): Replace with narrative/icon wrapper.
binh-dam-ibigroup cae2ba7
refactor(connectLocationField): Add comment detail about leaving loca…
binh-dam-ibigroup 6d5f731
Merge branch 'improve-save-user-locations' into connect-location-field
binh-dam-ibigroup c3405b4
Merge pull request #284 from opentripplanner/connect-location-field
binh-dam-ibigroup eccfa5c
refactor(mobile/NavigationBar): Replace FontAwesome with narrative/Icon
binh-dam-ibigroup 4227cd6
refactor(util/user): Move isHome and isWork to util.
binh-dam-ibigroup 9298f94
refactor(NewFavoriteLocation): Split NewFavoriteLocation from Favorit…
binh-dam-ibigroup bcce0e4
refactor(FavoriteLocation): Replace isFixed prop with placeholder prop
binh-dam-ibigroup 23f0829
feat(FavoriteLocation): Allow user to edit nickname of favorite locat…
binh-dam-ibigroup b5b3739
refactor(FixedFavoriteLocation): Extract FixedFavoriteLocation. Move …
binh-dam-ibigroup c5ec4f6
refactor(FavoriteLocation*): Make a few tweaks
binh-dam-ibigroup 4a33ffd
fix(UserAccountScreen): Fix blank home/work place labels on new accounts
binh-dam-ibigroup 3787ba8
refactor(UserAccountScreen): Force name for home and work locations.
binh-dam-ibigroup 18d2ad3
refactor(favorite-locations): Move location components to subfolder.
binh-dam-ibigroup 8a0ea44
fix(constants): update auth0 scope for ibi-group/otp-middleware#120
landonreed b421fd3
refactor(FavoriteLocation): Change component for new desired behavior.
binh-dam-ibigroup fe5f6a6
refactor(FavoritePlaceRow): Rename. Absorb NewFavoriteLocation.
binh-dam-ibigroup 18b4b5c
refactor(FavoritePlaceScreen): Extract place editing to separate screen.
binh-dam-ibigroup 8350db6
improvement(places): Add navigation, editing, and saving functionality
binh-dam-ibigroup 1b564a2
refactor(SavedTripScreen): Improve getting trip id from URL
binh-dam-ibigroup 9c03c69
improvement(FavoritePlaceScreen): Add validation
binh-dam-ibigroup cce939f
refactor: Reuse code to get validation state
binh-dam-ibigroup 337ba7b
refactor: Rename/move components, remove dead code.
binh-dam-ibigroup 4f2e012
refactor(FavoritePlaceRow): Remove Formik dependency; refactor.
binh-dam-ibigroup 29b4cf0
refactor(PlaceEditor): Fix typos
binh-dam-ibigroup 298a4bc
refactor: Fix import order
binh-dam-ibigroup 0646041
refactor(ResponsiveWebapp): Move TODO comment into #309.
binh-dam-ibigroup 4528844
Merge branch 'dev' into improve-save-user-locations
binh-dam-ibigroup 6930036
refactor(FavoritePlaceEditor): Merge with new page design
binh-dam-ibigroup 53797da
refactor: Address PR review comments.
binh-dam-ibigroup c08040e
refactor(FavoritePlacesPane): Delete updates db on the spot.
binh-dam-ibigroup 6af8e50
refactor(FavoritePlaceRow): Fix new place broken link.
binh-dam-ibigroup d18258d
fix(BackToTripPlanner): Preserve query params.
binh-dam-ibigroup 39756cb
refactor(FavoritePlaceRow): Preserve search params in links.
binh-dam-ibigroup 707d323
refactor(FavoritePlacesPane): Add /account/places to constants.
binh-dam-ibigroup 397254b
refactor(connected-links): Move code to retireve redux query to new c…
binh-dam-ibigroup eb9f998
docs(connected-links): Tweak comments.
binh-dam-ibigroup 757a84e
fix(UserAccountScreen): Return to places pane after new user edits.
binh-dam-ibigroup 96f261b
refactor(SequentialPaneDisplay): Improve navigation handling.
binh-dam-ibigroup 56069bf
refactor: Fix broken links, add comments.
binh-dam-ibigroup 2a10e54
refactor: Make various refactors.
binh-dam-ibigroup 060ebb0
refactor(BackLink): Extract back button link.
binh-dam-ibigroup e011260
refactor(BackLink): Move markup into BackLink
binh-dam-ibigroup addfaf9
refactor(FavoritePlacePage): Use BackLink
binh-dam-ibigroup bdcebdf
refactor(SequentialPaneDisplay): Improve routing
binh-dam-ibigroup 209318f
improvement(PlaceLocationField): Accommodate mobile view.
binh-dam-ibigroup b207eb6
refactor(connected-links): Remove empty mapDispatchToProps
binh-dam-ibigroup d121350
refactor(actions/user): Sort places after fetch. Refactor accordingly.
binh-dam-ibigroup 35eb848
refactor(connected-links): Rename exports per PR comments.
binh-dam-ibigroup 436b93d
refactor: Address some PR comments
binh-dam-ibigroup 65c087f
refactor(PlaceLocationField): Show ellipsis for long place names in m…
binh-dam-ibigroup 6c9e778
refactor(BackLink,BackToTripPlanner): Use icon with margin, refactor.
binh-dam-ibigroup 7681713
refactor(FavoritePlacesList): Fix renaming snafu
binh-dam-ibigroup e74f3f0
refactor(PlaceEditor): Fix ToogleButtonGroup prop
binh-dam-ibigroup 2df41d8
refactor(VerifyEmailPane): Map email verif pane with its own URL.
binh-dam-ibigroup 53d7b15
refactor(UserAccountScreen): Remove passing panes prop.
binh-dam-ibigroup 60b8864
refactor(places): Address browser console errors.
binh-dam-ibigroup 70f449c
fix(FavoritePlaceScreen): Do not show account header while setting up…
binh-dam-ibigroup 411caf1
refactor(FavoritePlaceScreen): Use FormNavigationButtons.
binh-dam-ibigroup 84bda39
refactor(FavoritePlaceScreen): Add space before back/save buttons.
binh-dam-ibigroup 127e97d
refactor(PlaceLocationField): Accommodate Back/Save buttons below the…
binh-dam-ibigroup 9da1fec
refactor(PlaceLocationField): Fix lint
binh-dam-ibigroup a083c8b
Revert "refactor(PlaceLocationField): Fix lint"
binh-dam-ibigroup 7985f67
Revert "refactor(PlaceLocationField): Accommodate Back/Save buttons b…
binh-dam-ibigroup 326199f
refactor(FavoritePlaceScreen): Use FormNavigationButtons on desktop v…
binh-dam-ibigroup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,53 @@ | ||
| import { connect } from 'react-redux' | ||
|
|
||
| import * as apiActions from '../../actions/api' | ||
| import * as locationActions from '../../actions/location' | ||
| import { getActiveSearch, getShowUserSettings } from '../../util/state' | ||
|
|
||
| /** | ||
| * This higher-order component connects the target (styled) LocationField to the | ||
| * redux store. | ||
| * @param StyledLocationField The input LocationField component to connect. | ||
| * @param options Optional object with the following optional props: | ||
| * - actions: a list of actions to include in mapDispatchToProps | ||
| * - includeLocation: whether to derive the location prop from | ||
| * the active query | ||
| * @returns The connected component. | ||
| */ | ||
| export default function connectLocationField (StyledLocationField, options = {}) { | ||
| // By default, set actions to empty list and do not include location. | ||
| const {actions = [], includeLocation = false} = options | ||
| const mapStateToProps = (state, ownProps) => { | ||
| const { config, currentQuery, location, transitIndex, user } = state.otp | ||
| const { currentPosition, nearbyStops, sessionSearches } = location | ||
| const activeSearch = getActiveSearch(state.otp) | ||
| const query = activeSearch ? activeSearch.query : currentQuery | ||
|
|
||
| const stateToProps = { | ||
| currentPosition, | ||
| geocoderConfig: config.geocoder, | ||
| nearbyStops, | ||
| sessionSearches, | ||
| showUserSettings: getShowUserSettings(state.otp), | ||
| stopsIndex: transitIndex.stops, | ||
| userLocationsAndRecentPlaces: [...user.locations, ...user.recentPlaces] | ||
| } | ||
| // Set the location prop only if includeLocation is specified, else leave unset. | ||
| // Otherwise, the StyledLocationField component will use the fixed undefined/null value as location | ||
| // and will not respond to user input. | ||
| if (includeLocation) { | ||
| stateToProps.location = query[ownProps.locationType] | ||
| } | ||
|
|
||
| return stateToProps | ||
| } | ||
|
|
||
| const mapDispatchToProps = { | ||
| addLocationSearch: locationActions.addLocationSearch, | ||
| findNearbyStops: apiActions.findNearbyStops, | ||
| getCurrentPosition: locationActions.getCurrentPosition, | ||
| ...actions | ||
| } | ||
|
|
||
| return connect(mapStateToProps, mapDispatchToProps)(StyledLocationField) | ||
| } |
This file contains hidden or 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,39 @@ | ||
| import React from 'react' | ||
| import { connect } from 'react-redux' | ||
| import { LinkContainer } from 'react-router-bootstrap' | ||
| import { Redirect } from 'react-router' | ||
| import { Link } from 'react-router-dom' | ||
|
|
||
| /** | ||
| * This function enhances the routing components imported above | ||
| * by preserving the itinerary search query from the redux state | ||
| * when redirecting the user between the main map and account-related pages, | ||
| * so that when the user returns to the map, the itinerary that was previously | ||
| * displayed is shown again. | ||
| * Implementers only need to specify the 'to' route and | ||
| * do not need to hook to redux store to retrieve the itinerary search query. | ||
| * @param RoutingComponent The routing component to enhance. | ||
| * @returns A new component that passes the redux search params to | ||
| * the RoutingComponent's 'to' prop. | ||
| */ | ||
| const withQueryParams = RoutingComponent => | ||
| ({ children, queryParams, to, ...props }) => ( | ||
| <RoutingComponent {...props} to={{ pathname: to, search: queryParams }}> | ||
| {children} | ||
| </RoutingComponent> | ||
| ) | ||
|
|
||
| // For connecting to the redux store | ||
| const mapStateToProps = (state, ownProps) => { | ||
| return { | ||
| queryParams: state.router.location.search | ||
| } | ||
| } | ||
|
|
||
| // Enhance routing components, connect the result to redux, | ||
| // and export. | ||
| export default { | ||
| LinkWithQuery: connect(mapStateToProps)(withQueryParams(Link)), | ||
| LinkContainerWithQuery: connect(mapStateToProps)(withQueryParams(LinkContainer)), | ||
| RedirectWithQuery: connect(mapStateToProps)(withQueryParams(Redirect)) | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't think the client should be concerned with this, but I won't make this blocking so we can move forward. I do think we should add an issue to otp-middleware that handles this sorting before persisting an update and ensures that there is only one home/work location for any given user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted in ibi-group/otp-middleware#136.