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

Transfer leg support #779

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 18 additions & 15 deletions .storybook/react-intl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,25 @@ const messages = {};

// Populate messages if not running snapshots.
// (Message printouts would be unnecessary replicated in snapshots without that check.)
packages.forEach((pkg) => {
locales.forEach((locale) => {
// Chinese-simplified is assigned a special file name by Weblate.
const localeFile = locale === "zh" ? "zh_Hans" : locale;
try {
messages[locale] = {
...messages[locale],
...flatten(require(`../packages/${pkg}/i18n/${localeFile}.yml`).default)
};
} catch (e) {
// There is no yml files for the "unknown" locale,
// so it should fail, and we won't display an error message in that case.
if (locale !== "unknown") console.error(e);
}
if (typeof window !== "undefined") {

packages.forEach((pkg) => {
locales.forEach((locale) => {
// Chinese-simplified is assigned a special file name by Weblate.
const localeFile = locale === "zh" ? "zh_Hans" : locale;
try {
messages[locale] = {
...messages[locale],
...flatten(require(`../packages/${pkg}/i18n/${localeFile}.yml`).default)
};
} catch (e) {
// There is no yml files for the "unknown" locale,
// so it should fail, and we won't display an error message in that case.
if (locale !== "unknown") console.error(e);
}
});
});
});
}

// TODO: place any applicable (date, time, etc) format parameters here.
const formats = {};
Expand Down
1 change: 1 addition & 0 deletions packages/itinerary-body/i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ otpUi:
carHail: Ride
escooter: Ride
walk: Walk
transfer: Transfer{duration, select, undefined {} other {, wait {duration}}}
unnamedPath: Unnamed Path
unnamedRoad: Unnamed Road
vehicleTitle: "{company} {vehicleType}"
Expand Down
3 changes: 3 additions & 0 deletions packages/itinerary-body/i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ otpUi:
carHail: Course en voiture
escooter: Trottinette
walk: Marche
transfer: >-
Correspondance{duration, select, undefined {} other {, attente
{duration}}}
unnamedPath: Chemin sans nom
unnamedRoad: Route sans nom
vehicleTitle: "{vehicleType} {company}"
Expand Down
112 changes: 58 additions & 54 deletions packages/itinerary-body/src/AccessLegBody/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,63 +125,67 @@ class AccessLegBody extends Component<Props, State> {
onSummaryClick={this.onSummaryClick}
showLegIcon={showLegIcon}
/>
<S.LegDetails>
{hideDrivingDirections ? (
<S.StepsHeaderAndMapLink>
<S.StepsHeaderSpan>
<Duration seconds={leg.duration} />
</S.StepsHeaderSpan>
{mapillary}
</S.StepsHeaderAndMapLink>
) : (
<>
{leg.distance !== 0 && (
<S.LegDetails>
{hideDrivingDirections ? (
<S.StepsHeaderAndMapLink>
<S.StepsHeaderButton
aria-expanded={expanded}
onClick={this.onStepsHeaderClick}
>
<Duration
seconds={leg.duration}
showApproximatePrefix={
showApproximateTravelTime && !isTransit(leg.mode)
}
/>
{leg.steps && leg.steps.length > 0 && (
<S.CaretToggle expanded={expanded} />
)}

<S.InvisibleAdditionalDetails>
<FormattedMessage
defaultMessage={
defaultMessages["otpUi.TransitLegBody.expandDetails"]
}
description="Screen reader text added to expand steps"
id="otpUi.TransitLegBody.expandDetails"
/>
</S.InvisibleAdditionalDetails>
</S.StepsHeaderButton>
<S.StepsHeaderSpan>
<Duration seconds={leg.duration} />
</S.StepsHeaderSpan>
{mapillary}
</S.StepsHeaderAndMapLink>
<AnimateHeight
duration={500}
height={expanded ? "auto" : 0}
style={{ gridColumn: "1 / span 2" }}
>
<AccessLegSteps
mapillaryCallback={mapillaryCallback}
mapillaryKey={mapillaryKey}
steps={leg.steps}
/>
</AnimateHeight>
</>
)}
<LegDiagramPreview
diagramVisible={diagramVisible}
leg={leg}
setLegDiagram={setLegDiagram}
showElevationProfile={showElevationProfile}
/>
</S.LegDetails>
) : (
<>
<S.StepsHeaderAndMapLink>
<S.StepsHeaderButton
aria-expanded={expanded}
onClick={this.onStepsHeaderClick}
>
<Duration
seconds={leg.duration}
showApproximatePrefix={
showApproximateTravelTime && !isTransit(leg.mode)
}
/>
{leg.steps && leg.steps.length > 0 && (
<S.CaretToggle expanded={expanded} />
)}

<S.InvisibleAdditionalDetails>
<FormattedMessage
defaultMessage={
defaultMessages[
"otpUi.TransitLegBody.expandDetails"
]
}
description="Screen reader text added to expand steps"
id="otpUi.TransitLegBody.expandDetails"
/>
</S.InvisibleAdditionalDetails>
</S.StepsHeaderButton>
{mapillary}
</S.StepsHeaderAndMapLink>
<AnimateHeight
duration={500}
height={expanded ? "auto" : 0}
style={{ gridColumn: "1 / span 2" }}
>
<AccessLegSteps
mapillaryCallback={mapillaryCallback}
mapillaryKey={mapillaryKey}
steps={leg.steps}
/>
</AnimateHeight>
</>
)}
<LegDiagramPreview
diagramVisible={diagramVisible}
leg={leg}
setLegDiagram={setLegDiagram}
showElevationProfile={showElevationProfile}
/>
</S.LegDetails>
)}
</S.LegBody>
</>
);
Expand Down
Loading
Loading