Skip to content
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

DT-5921 Add car ferry functionality #5121

Open
wants to merge 17 commits into
base: v3
Choose a base branch
from
Open

Conversation

VillePihlava
Copy link
Contributor

@VillePihlava VillePihlava commented Oct 15, 2024

This should not be merged before the functionality from this pr can be used opentripplanner/OpenTripPlanner#5966,

Proposed Changes

  • Add car ferry functionality
    • matka config
    • waltti config
  • Direct car and cars on transit combination view
  • Add overflow icon
  • Remove leg text for itineraries for ferries in the matka config
  • Fix leg-before-line width for bikes from 6px to 8px
  • Fix color for the secondary icon in the alternative itinerary bar

@VillePihlava VillePihlava changed the title DT-5921 Add car ferry functionality [Do not merge] DT-5921 Add car ferry functionality Oct 15, 2024
Copy link
Member

@vesameskanen vesameskanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work. I suggested a fair amount of mainly cosmetic changes, which make the code easier to read and understand.

In general, try to avoid adding unncecessary validation checks 'just in case'. The code should fail fast and crash if variable values are not valid.

app/component/RouteNumberContainer.js Outdated Show resolved Hide resolved
app/component/RouteNumberContainer.js Outdated Show resolved Hide resolved
app/component/itinerary/CarLeg.js Outdated Show resolved Hide resolved
Comment on lines 90 to 91
<div className={cx('itinerary-leg-action', 'car')}>
<div className="itinerary-leg-action-content">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge these into one div

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not change these for now. For example, there are similar divs in BicycleLeg, BikeParkLeg, CarParkLeg. Do you want all of these changed or none?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I understand. I would love to see all code improving continuously. Please fix this unless it feels unreasonably big task.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two divs have been merged everywhere I could find them.

Comment on lines 127 to 128
<div className={cx('itinerary-leg-action', 'car')}>
<div className="itinerary-leg-action-content">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge divs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not change these for now. For example, there are similar divs in BicycleLeg, BikeParkLeg, CarParkLeg. Do you want all of these changed or none?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two divs have been merged everywhere I could find them.

app/component/itinerary/ItineraryList.js Outdated Show resolved Hide resolved
app/component/itinerary/ItineraryPage.js Show resolved Hide resolved
app/component/itinerary/ItineraryPage.js Outdated Show resolved Hide resolved
app/component/itinerary/ItineraryPage.js Outdated Show resolved Hide resolved
@vesameskanen
Copy link
Member

There is a conflict.

Copy link
Member

@vesameskanen vesameskanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some new logic errors related to car+public itinerary list creation. Please read my review comments.

return (
transitModes.length > 0 &&
settings.includeCarSuggestions &&
config.carBoardingModes?.FERRY !== undefined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong. I suggest:

settings.includeCarSuggestions && filterTransitModes(...).length > 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to transitModes.length > 0 && settings.includeCarSuggestions. I didn't realize previously that transitModes is filtered earlier with filterTransitModes.

app/component/itinerary/ItineraryPage.js Show resolved Hide resolved
@VillePihlava VillePihlava changed the title [Do not merge] DT-5921 Add car ferry functionality DT-5921 Add car ferry functionality Oct 31, 2024
@VillePihlava VillePihlava marked this pull request as ready for review October 31, 2024 08:48
Copy link
Member

@vesameskanen vesameskanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now but merge confict must be resolved.

@@ -277,6 +280,9 @@ const Itinerary = (
);
const usingOwnBicycleWholeTrip =
usingOwnBicycle && itinerary.legs.every(leg => !leg.to?.vehicleParking);
const usingOwnCar = itinerary.legs.some(leg => getLegMode(leg) === 'CAR');
const usingOwnCarWholeTrip =
usingOwnCar && itinerary.legs.every(leg => !leg.to?.vehicleParking);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, unit tests often use bad mock data. Fixing code causes huge amount of test failures which is really annoying.

@VillePihlava
Copy link
Contributor Author

Merge conflicts resolved

Copy link
Member

@vesameskanen vesameskanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be merged after next hotfix release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants