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

Merged
merged 20 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ec65410
Change configs for cars on ferries.
VillePihlava Oct 4, 2024
b6904f1
Add icons for cars on ferries.
VillePihlava Oct 4, 2024
fc90478
Add translations for cars on ferries.
VillePihlava Oct 4, 2024
6d83ac6
Add functionality for cars on ferries.
VillePihlava Oct 4, 2024
2953a88
Remove unnecessary parts from script.
VillePihlava Oct 11, 2024
a12ad0e
Fix wrong color for the secondary icon in the alternative itinerary b…
VillePihlava Oct 15, 2024
450fb49
Fix bike leg-before-line width from 6px to 8px.
VillePihlava Oct 15, 2024
319297d
Changes based on review comments.
VillePihlava Oct 29, 2024
98e19d9
Merge branch 'v3' of github.com:HSLdevcom/digitransit-ui into car-fer…
VillePihlava Oct 29, 2024
e9d2c35
Merge itinerary-leg-action and itinerary-leg-action-content divs.
VillePihlava Oct 31, 2024
c90f7d3
Remove the ? from all uses of leg.to?.field and leg.from?.field.
VillePihlava Oct 31, 2024
edf8305
Remove with-car-info-notification-icon and with-bike-info-notificatio…
VillePihlava Oct 31, 2024
201b2af
Fix use of settings.includeCarSuggestions.
VillePihlava Oct 31, 2024
7a0a5a3
Fix PLANTYPE.CARTRANSIT case in planParamUtil.
VillePihlava Oct 31, 2024
d879234
Add ? back to leg.to check to fix failing test.
VillePihlava Oct 31, 2024
21c4fbc
Add checks for mergeCarDirectAndTransitPlans.
VillePihlava Oct 31, 2024
318f55d
Merge branch 'v3' of github.com:HSLdevcom/digitransit-ui into car-fer…
VillePihlava Nov 1, 2024
f3550dd
Filter out car and bike transit itineraries that have a higher durati…
VillePihlava Dec 17, 2024
3f6a570
Merge branch 'v3' of github.com:HSLdevcom/digitransit-ui into car-fer…
VillePihlava Dec 17, 2024
c60bdaf
Remove bike transit itinerary filtering functionality.
VillePihlava Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion app/component/RouteNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const LONG_ROUTE_NUMBER_LENGTH = 6;

function RouteNumber(props, context) {
const mode = props.mode.toLowerCase();
const { alertSeverityLevel, color, withBicycle, text } = props;
const { alertSeverityLevel, color, withBicycle, withCar, text } = props;
const isScooter = mode === TransportMode.Scooter.toLowerCase();
const textIsText = typeof text === 'string'; // can be also react node
const longText =
Expand Down Expand Up @@ -57,6 +57,12 @@ function RouteNumber(props, context) {
className="itinerary-icon_with-bicycle"
/>
)}
{withCar && (
<Icon
img="icon-icon_car-withoutBox"
className="itinerary-icon_with-car"
/>
)}
</React.Fragment>
);
}
Expand All @@ -83,6 +89,12 @@ function RouteNumber(props, context) {
className="itinerary-icon_with-bicycle"
/>
)}
{withCar && (
<Icon
img="icon-icon_car-withoutBox"
className="itinerary-icon_with-car"
/>
)}
</React.Fragment>
);
};
Expand Down Expand Up @@ -206,6 +218,7 @@ RouteNumber.propTypes = {
duration: PropTypes.number,
isTransitLeg: PropTypes.bool,
withBicycle: PropTypes.bool,
withCar: PropTypes.bool,
card: PropTypes.bool,
appendClass: PropTypes.string,
occupancyStatus: PropTypes.string,
Expand All @@ -228,6 +241,7 @@ RouteNumber.defaultProps = {
isTransitLeg: false,
renderModeIcons: false,
withBicycle: false,
withCar: false,
color: undefined,
duration: undefined,
occupancyStatus: undefined,
Expand Down
11 changes: 6 additions & 5 deletions app/component/RouteNumberContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const RouteNumberContainer = (
className,
route,
isCallAgency,
withBicycle,
occupancyStatus,
mode,
...props
Expand All @@ -25,8 +24,12 @@ const RouteNumberContainer = (
isCallAgency={isCallAgency}
color={route.color ? `#${route.color}` : null}
mode={mode !== undefined ? mode : route.mode}
text={getLegText(route, config, interliningWithRoute)}
withBicycle={withBicycle}
text={
config.disabledLegTextModes?.includes(route.mode) &&
className.includes('line')
? ''
: getLegText(route, config, interliningWithRoute)
}
occupancyStatus={occupancyStatus}
{...props}
/>
Expand All @@ -40,7 +43,6 @@ RouteNumberContainer.propTypes = {
vertical: PropTypes.bool,
className: PropTypes.string,
fadeLong: PropTypes.bool,
withBicycle: PropTypes.bool,
occupancyStatus: PropTypes.string,
mode: PropTypes.string,
};
Expand All @@ -52,7 +54,6 @@ RouteNumberContainer.defaultProps = {
vertical: false,
fadeLong: false,
className: '',
withBicycle: false,
occupancyStatus: undefined,
mode: undefined,
};
Expand Down
11 changes: 11 additions & 0 deletions app/component/itinerary/AlternativeItineraryBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function AlternativeItineraryBar(
bikePlan,
bikePublicPlan,
carPlan,
carPublicPlan,
parkRidePlan,
loading,
},
Expand Down Expand Up @@ -69,6 +70,14 @@ export default function AlternativeItineraryBar(
onClick={selectStreetMode}
/>
)}
{carPublicPlan?.edges?.length > 0 && (
<StreetModeSelectorButton
icon="icon-icon_car-withoutBox"
name={streetHash.carAndVehicle}
plan={carPublicPlan}
onClick={selectStreetMode}
/>
)}
{config.emphasizeOneWayJourney && (
<div style={{ alignSelf: 'center' }}>
<FormattedMessage
Expand All @@ -90,6 +99,7 @@ AlternativeItineraryBar.propTypes = {
bikePublicPlan: planShape,
parkRidePlan: planShape,
carPlan: planShape,
carPublicPlan: planShape,
weatherData: PropTypes.shape({
temperature: PropTypes.number,
windSpeed: PropTypes.number,
Expand All @@ -105,6 +115,7 @@ AlternativeItineraryBar.defaultProps = {
bikePublicPlan: undefined,
parkRidePlan: undefined,
carPlan: undefined,
carPublicPlan: undefined,
loading: undefined,
};

Expand Down
179 changes: 96 additions & 83 deletions app/component/itinerary/BicycleLeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ export default function BicycleLeg(
/>
);
} else if (bicycleWalkLeg) {
const modeClassNames = bicycleWalkLeg.to?.stop
? [modeClassName, bicycleWalkLeg.mode.toLowerCase()]
: [bicycleWalkLeg.mode.toLowerCase(), modeClassName];
circleLine = (
<ItineraryCircleLineLong index={index} modeClassNames={modeClassNames} />
<ItineraryCircleLineLong
index={index}
modeClassName={modeClassName}
boardingLeg={bicycleWalkLeg}
/>
);
} else if (mode === 'BICYCLE') {
circleLine = (
Expand Down Expand Up @@ -315,42 +316,46 @@ export default function BicycleLeg(
</div>
)}
{bicycleWalkLeg?.from.stop && (
<div className={cx('itinerary-leg-action', 'bicycle')}>
<div className="itinerary-leg-action-content">
{bicycleWalkLeg.distance === -1 ? (
<FormattedMessage
id="bicycle-walk-from-transit-no-duration"
values={{
transportMode: (
<FormattedMessage
id={`from-${bicycleWalkLeg.from.stop.vehicleMode.toLowerCase()}`}
/>
),
}}
/>
) : (
<FormattedMessage
id="bicycle-walk-from-transit"
values={{
transportMode: (
<FormattedMessage
id={`from-${bicycleWalkLeg.from.stop.vehicleMode.toLowerCase()}`}
/>
),
duration: durationToString(bicycleWalkLeg.duration * 1000),
distance: displayDistance(
parseInt(bicycleWalkLeg.distance, 10),
config,
intl.formatNumber,
),
}}
/>
)}
<ItineraryMapAction
target={leg.from.name || ''}
focusAction={focusAction}
<div
className={cx(
'itinerary-leg-action',
'bicycle',
'itinerary-leg-action-content',
)}
>
{bicycleWalkLeg.distance === -1 ? (
<FormattedMessage
id="bicycle-walk-from-transit-no-duration"
values={{
transportMode: (
<FormattedMessage
id={`from-${bicycleWalkLeg.from.stop.vehicleMode.toLowerCase()}`}
/>
),
}}
/>
</div>
) : (
<FormattedMessage
id="bicycle-walk-from-transit"
values={{
transportMode: (
<FormattedMessage
id={`from-${bicycleWalkLeg.from.stop.vehicleMode.toLowerCase()}`}
/>
),
duration: durationToString(bicycleWalkLeg.duration * 1000),
distance: displayDistance(
parseInt(bicycleWalkLeg.distance, 10),
config,
intl.formatNumber,
),
}}
/>
)}
<ItineraryMapAction
target={leg.from.name || ''}
focusAction={focusAction}
/>
</div>
)}
{isScooter && !scooterSettingsOn && (
Expand Down Expand Up @@ -401,53 +406,61 @@ export default function BicycleLeg(
</div>
</div>
)}
<div className={cx('itinerary-leg-action', 'bike')}>
<div className="itinerary-leg-action-content">
{stopsDescription}
<ItineraryMapAction
target=""
ariaLabelId="itinerary-summary-row.clickable-area-description"
focusAction={focusToLeg}
/>
</div>
<div
className={cx(
'itinerary-leg-action',
'bike',
'itinerary-leg-action-content',
)}
>
{stopsDescription}
<ItineraryMapAction
target=""
ariaLabelId="itinerary-summary-row.clickable-area-description"
focusAction={focusToLeg}
/>
</div>
{bicycleWalkLeg && bicycleWalkLeg?.to.stop && (
<div className={cx('itinerary-leg-action', 'bicycle')}>
<div className="itinerary-leg-action-content">
{bicycleWalkLeg.distance === -1 ? (
<FormattedMessage
id="bicycle-walk-to-transit-no-duration"
values={{
transportMode: (
<FormattedMessage
id={`to-${bicycleWalkLeg.to.stop?.vehicleMode.toLowerCase()}`}
/>
),
}}
/>
) : (
<FormattedMessage
id="bicycle-walk-to-transit"
values={{
transportMode: (
<FormattedMessage
id={`to-${bicycleWalkLeg.to.stop.vehicleMode.toLowerCase()}`}
/>
),
duration: durationToString(bicycleWalkLeg.duration * 1000),
distance: displayDistance(
parseInt(bicycleWalkLeg.distance, 10),
config,
intl.formatNumber,
),
}}
/>
)}
<ItineraryMapAction
target={leg.from.name || ''}
focusAction={focusAction}
<div
className={cx(
'itinerary-leg-action',
'bicycle',
'itinerary-leg-action-content',
)}
>
{bicycleWalkLeg.distance === -1 ? (
<FormattedMessage
id="bicycle-walk-to-transit-no-duration"
values={{
transportMode: (
<FormattedMessage
id={`to-${bicycleWalkLeg.to.stop?.vehicleMode.toLowerCase()}`}
/>
),
}}
/>
</div>
) : (
<FormattedMessage
id="bicycle-walk-to-transit"
values={{
transportMode: (
<FormattedMessage
id={`to-${bicycleWalkLeg.to.stop.vehicleMode.toLowerCase()}`}
/>
),
duration: durationToString(bicycleWalkLeg.duration * 1000),
distance: displayDistance(
parseInt(bicycleWalkLeg.distance, 10),
config,
intl.formatNumber,
),
}}
/>
)}
<ItineraryMapAction
target={leg.from.name || ''}
focusAction={focusAction}
/>
</div>
)}
{isScooter && (
Expand Down
28 changes: 16 additions & 12 deletions app/component/itinerary/BikeParkLeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,22 @@ const BikeParkLeg = (
focusAction={focusAction}
/>
</div>
<div className={cx('itinerary-leg-action', 'bike')}>
<div className="itinerary-leg-action-content">
<FormattedMessage
id="walk-distance-duration"
values={{ distance, duration }}
defaultMessage="Walk {distance} ({duration})"
/>
<ItineraryMapAction
target={leg.from.name || ''}
focusAction={focusAction}
/>
</div>
<div
className={cx(
'itinerary-leg-action',
'bike',
'itinerary-leg-action-content',
)}
>
<FormattedMessage
id="walk-distance-duration"
values={{ distance, duration }}
defaultMessage="Walk {distance} ({duration})"
/>
<ItineraryMapAction
target={leg.from.name || ''}
focusAction={focusAction}
/>
</div>
</div>
</div>
Expand Down
Loading
Loading