-
Notifications
You must be signed in to change notification settings - Fork 34
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
Nearby view support #655
Nearby view support #655
Conversation
8e11fa3
to
a4483f6
Compare
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.
Could use some improvement in the future but it's good enough for now!
@miles-grant-ibigroup @daniel-heppner-ibigroup Is this one of these PRs that need to be split, especially for the types package, so that a version number is available for other packages to use as reference? |
import { FormattedMessage } from "react-intl"; | ||
|
||
import * as S from "../styled"; | ||
import { defaultMessages } from "../util"; | ||
|
||
interface Props { | ||
onStopClick: ({ stopId: string }) => void; | ||
stopId: string; | ||
onStopClick: (stop: Stop) => void; |
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.
This is a breaking change. Either:
- Add breaking change commits to all packages that use this new method signature, or,
- If maintaining compatibility, change the signature of
onStopClick
to(stop: Stop | { stopId: string })
(You could create an aliastype StopEventHanlder = (stop: Stop | { stopId: string }) => void
in the types package to avoid repetition.)
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.
That's a great idea! I'll add it. Thank you for the suggestion
Merge conflicts resolved, ready for another look @binh-dam-ibigroup |
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.
Could you address the tsc
error during yarn build
?
That's embarrassing. I assigned it back to you before I finished my commits. |
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.
Update references to the types package to 6.2.0, keep the stopId
prop in ViewStopButton
, and probably take the tile overlay and stops overlay changes out of this PR (you will need another PR anyway to resolve references to non-alpha versions).
import { FormattedMessage } from "react-intl"; | ||
|
||
import * as S from "../styled"; | ||
import { defaultMessages } from "../util"; | ||
|
||
interface Props { | ||
onStopClick: ({ stopId: string }) => void; | ||
stopId: string; |
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.
Keep this prop (as a fallback) otherwise it is a breaking change.
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.
Made it an either or type, let me know if that's good
@@ -16,10 +16,10 @@ | |||
"react-map-gl": "^7.0.15" | |||
}, | |||
"dependencies": { | |||
"@opentripplanner/map-popup": "^2.0.5" | |||
"@opentripplanner/map-popup": "^2.0.7-alpha.1" |
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.
The tile overlay package should probably be released from a separate PR after the map popup package is released.
"@opentripplanner/map-popup": "^2.0.5", | ||
"@opentripplanner/base-map": "^3.0.15", | ||
"@opentripplanner/from-to-location-picker": "^2.1.10", | ||
"@opentripplanner/map-popup": "^2.0.7-alpha.1", |
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.
The stops overlay package should probably be released from a separate PR after the map popup package is released.
I can't update the Map Overlay package first because it breaks the types in other packages, since the callback can now return a Stop. I think that means a breaking change is unavoidable in Map Overlay and they have to be released with alpha packages. Sidenote, this is why upgrading to a more modern package manager such as yarn 3 or pnpm would be advantageous, since you can put |
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 think it is good to go with one tiny type tweak.
packages/itinerary-body/src/otp-react-redux/view-stop-button.tsx
Outdated
Show resolved
Hide resolved
That's fine, but then upgrade to the non-alpha versions soon after they are released. |
BREAKING CHANGE: Callback handler for setViewedStop needs to handle a Stop object
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.
Off to the races 🫡
# Conflicts: # yarn.lock
d76d949
into
opentripplanner:master
This PR adjusts all the places where the stop viewer is called to pass in the whole stop object rather than just the stop ID string. This allows support for the nearby view in OTP-RR, which relies on the lat/lon of the stop rather than its ID.