Skip to content

Commit

Permalink
fix: support new OTP2 leg step types
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Aug 17, 2023
1 parent ac88b04 commit 0f59675
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 50 deletions.
226 changes: 226 additions & 0 deletions __snapshots__/storybook.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24291,6 +24291,21 @@ exports[`Storyshots ItineraryBody/otp-react-redux Individual Leg Fare Components
"route": null,
"startTime": 1685139787000,
"steps": Array [
Object {
"relativeDirection": "ENTER_STATION",
"stayOn": false,
"streetName": "fake station name",
},
Object {
"relativeDirection": "FOLLOW_SIGNS",
"stayOn": false,
"streetName": "fake station exit",
},
Object {
"relativeDirection": "EXIT_STATION",
"stayOn": false,
"streetName": "fake station name",
},
Object {
"absoluteDirection": "EAST",
"alerts": Array [],
Expand Down Expand Up @@ -26196,6 +26211,89 @@ exports[`Storyshots ItineraryBody/otp-react-redux Individual Leg Fare Components
<ol
className="c32"
>
<li
className="c33"
>
<div
className="c34"
>
<svg
viewBox="0 0 261 261"
>
<path
d="M100.5 110.5v150h60v-150h40l-70-110-70 110h40z"
/>
</svg>
</div>
<div
className="c35"
>
<span>
ENTER_STATION
at
<span
className="c36"
>
fake station name
</span>
</span>
</div>
</li>
<li
className="c33"
>
<div
className="c34"
>
<svg
viewBox="0 0 261 261"
>
<path
d="M100.5 110.5v150h60v-150h40l-70-110-70 110h40z"
/>
</svg>
</div>
<div
className="c35"
>
<span>
Follow signs to
<span
className="c36"
>
fake station exit
</span>
</span>
</div>
</li>
<li
className="c33"
>
<div
className="c34"
>
<svg
viewBox="0 0 261 261"
>
<path
d="M100.5 110.5v150h60v-150h40l-70-110-70 110h40z"
/>
</svg>
</div>
<div
className="c35"
>
<span>
EXIT_STATION
at
<span
className="c36"
>
fake station name
</span>
</span>
</div>
</li>
<li
className="c33"
>
Expand Down Expand Up @@ -108122,6 +108220,21 @@ exports[`Storyshots ItineraryBody/otp-ui Individual Leg Fare Components 1`] = `
"route": null,
"startTime": 1685139787000,
"steps": Array [
Object {
"relativeDirection": "ENTER_STATION",
"stayOn": false,
"streetName": "fake station name",
},
Object {
"relativeDirection": "FOLLOW_SIGNS",
"stayOn": false,
"streetName": "fake station exit",
},
Object {
"relativeDirection": "EXIT_STATION",
"stayOn": false,
"streetName": "fake station name",
},
Object {
"absoluteDirection": "EAST",
"alerts": Array [],
Expand Down Expand Up @@ -109986,6 +110099,89 @@ exports[`Storyshots ItineraryBody/otp-ui Individual Leg Fare Components 2`] = `
<ol
className="c23"
>
<li
className="c24"
>
<div
className="c25"
>
<svg
viewBox="0 0 261 261"
>
<path
d="M100.5 110.5v150h60v-150h40l-70-110-70 110h40z"
/>
</svg>
</div>
<div
className="c26"
>
<span>
ENTER_STATION
at
<span
className="c27"
>
fake station name
</span>
</span>
</div>
</li>
<li
className="c24"
>
<div
className="c25"
>
<svg
viewBox="0 0 261 261"
>
<path
d="M100.5 110.5v150h60v-150h40l-70-110-70 110h40z"
/>
</svg>
</div>
<div
className="c26"
>
<span>
Follow signs to
<span
className="c27"
>
fake station exit
</span>
</span>
</div>
</li>
<li
className="c24"
>
<div
className="c25"
>
<svg
viewBox="0 0 261 261"
>
<path
d="M100.5 110.5v150h60v-150h40l-70-110-70 110h40z"
/>
</svg>
</div>
<div
className="c26"
>
<span>
EXIT_STATION
at
<span
className="c27"
>
fake station name
</span>
</span>
</div>
</li>
<li
className="c24"
>
Expand Down Expand Up @@ -239918,6 +240114,21 @@ exports[`Storyshots TripDetails Fare Leg Table Story Leg Products 1`] = `
"routeTextColor": undefined,
"startTime": 1685139787000,
"steps": Array [
Object {
"relativeDirection": "ENTER_STATION",
"stayOn": false,
"streetName": "fake station name",
},
Object {
"relativeDirection": "FOLLOW_SIGNS",
"stayOn": false,
"streetName": "fake station exit",
},
Object {
"relativeDirection": "EXIT_STATION",
"stayOn": false,
"streetName": "fake station name",
},
Object {
"absoluteDirection": "EAST",
"alerts": Array [],
Expand Down Expand Up @@ -241675,6 +241886,21 @@ exports[`Storyshots TripDetails Leg Fare Products Itinerary 1`] = `
"route": null,
"startTime": 1685139787000,
"steps": Array [
Object {
"relativeDirection": "ENTER_STATION",
"stayOn": false,
"streetName": "fake station name",
},
Object {
"relativeDirection": "FOLLOW_SIGNS",
"stayOn": false,
"streetName": "fake station exit",
},
Object {
"relativeDirection": "EXIT_STATION",
"stayOn": false,
"streetName": "fake station name",
},
Object {
"absoluteDirection": "EAST",
"alerts": Array [],
Expand Down
8 changes: 8 additions & 0 deletions packages/icons/src/directions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ function DirectionIcon({ relativeDirection }) {
return <CircleCounterclockwise />;
case "ELEVATOR":
return <Elevator />;
case "FOLLOW_SIGNS":
// TODO: Better/custom icon?
return <Straight />;
case "ENTER_STATION":
case "EXIT_STATION":
// TODO: Better/custom icon?
return <Straight />;

default:
return null;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/itinerary-body/i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ otpUi:
circleClockwise: Follow circle clockwise
circleCounterClockwise: Follow circle counterclockwise
continue: Continue
enterStation: Enter station
exitStation: Exit station
hardLeft: Hard left
hardRight: Hard right
left: Left
Expand All @@ -35,6 +37,7 @@ otpUi:
uTurnRight: Right U-turn
stepDepart: Head {heading} on {street}
stepElevator: Take elevator to {street}
stepFollowSigns: Follow signs to {street}
stepGeneric: "{step} on {street}"
stepHeading:
east: east
Expand All @@ -45,6 +48,7 @@ otpUi:
southeast: southeast
southwest: southwest
west: west
stepStation: "{step} at {street}"
summary: "{mode} to {place}"
summaryAndDistance: "{mode} {distance} to {place}"
summaryMode:
Expand Down
10 changes: 6 additions & 4 deletions packages/itinerary-body/i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ otpUi:
circleClockwise: Prenez le rond-point par la gauche
circleCounterClockwise: Prenez le rond-point par la droite
continue: Continuez
enterStation: TODO
exitStation: TODO
hardLeft: Virage à gauche
hardRight: Virage à droite
left: Tournez à gauche
Expand All @@ -39,6 +41,7 @@ otpUi:
uTurnRight: Demi-tour par la droite
stepDepart: Dirigez-vous vers {heading} sur {street}
stepElevator: Prenez l'ascenseur jusqu'à {street}
stepFollowSigns: TODO {street}
stepGeneric: "{step} sur {street}"
stepHeading:
east: l'est
Expand All @@ -49,6 +52,7 @@ otpUi:
southeast: le sud-est
southwest: le sud-ouest
west: l'ouest
stepStation: "{step} TODO {street}"
summary: "{mode} vers {place}"
summaryAndDistance: "{mode} - {distance} vers {place}"
summaryMode:
Expand All @@ -70,8 +74,7 @@ otpUi:
ItineraryBody:
common:
durationShort: "{hours, plural, =0 {} other {# h }}{minutes} min"
flexAdvanceNotice: " au moins {leadDays, plural, one {# jour} other {# jours}}\
\ à l'avance"
flexAdvanceNotice: " au moins {leadDays, plural, one {# jour} other {# jours}} à l'avance"
flexCallAhead: réserver au préalable
flexCallNumber: réserver au {phoneNumber}
flexPickupMessage: Pour emprunter cette ligne, vous devez {action}{advanceNotice}.
Expand Down Expand Up @@ -100,8 +103,7 @@ otpUi:
legDetails: Détails de l'étape
operatedBy: Exploité par {agencyLink}
ride: Prenez la ligne
rideDurationAndStops: "Trajet : {duration}{numStops, plural, =1 {} other { / #\
\ arrêts}}"
rideDurationAndStops: "Trajet : {duration}{numStops, plural, =1 {} other { / # arrêts}}"
routeDescription: "{routeName} <toPrefix>vers</toPrefix> {headsign}"
stopId: Arrêt n°{stopId}
stopIdBasic: Arrêt n°{stopId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@
}
},
"steps": [
{
"relativeDirection": "ENTER_STATION",
"stayOn": false,
"streetName": "fake station name"
},
{
"relativeDirection": "FOLLOW_SIGNS",
"stayOn": false,
"streetName": "fake station exit"
},
{
"relativeDirection": "EXIT_STATION",
"stayOn": false,
"streetName": "fake station name"
},
{
"distance": 36.61,
"lat": 47.7791959,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@
"route": null,
"startTime": 1686620636000,
"steps": [
{
"absoluteDirection": "EAST",
"alerts": [],
"area": false,
"distance": 0,
"elevationProfile": [],
"lat": 47.5990191,
"lon": -122.3279188,
"relativeDirection": "ENTER_STATION",
"stayOn": false,
"streetName": "fake station name"
},
{
"absoluteDirection": "WEST",
"alerts": [],
Expand Down
Loading

0 comments on commit 0f59675

Please sign in to comment.