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

fix: Moved "Return to Regular Route" into root directions list #2521

Merged
merged 11 commits into from
Mar 29, 2024
1 change: 0 additions & 1 deletion assets/src/components/detours/diversionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export const DiversionPage = ({
,
"Turn-by-Turn Directions:",
...(directions?.map((v) => v.instruction) ?? []),
"Return to Regular Route",
,
"Connection Points:",
connectionPoints?.start?.name ?? "N/A",
Expand Down
11 changes: 5 additions & 6 deletions assets/src/components/detours/diversionPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@ export const DiversionPanel = ({
<ListGroup as="ol">
{directions.map((d) => (
<ListGroup.Item key={d.instruction} as="li">
{d.instruction}
{d.instruction == "Return to Regular Route" ? (
<strong className="fw-medium">{d.instruction}</strong>
) : (
d.instruction
)}
</ListGroup.Item>
))}
{detourFinished && (
<ListGroup.Item as="li">
<strong className="fw-medium">Return to Regular Route</strong>
</ListGroup.Item>
)}
</ListGroup>
) : (
<DirectionsHelpText />
Expand Down
6 changes: 5 additions & 1 deletion assets/src/hooks/useDetour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ export const useDetour = ({ routePatternId, shape }: OriginalRoute) => {
)

const coordinates = isOk(detourShape) ? detourShape.ok.coordinates : []
const directions = isOk(detourShape) ? detourShape.ok.directions : undefined
const directions = isOk(detourShape)
? detourShape.ok.directions?.concat({
instruction: "Return to Regular Route",
hannahpurcell marked this conversation as resolved.
Show resolved Hide resolved
})
: undefined
firestack marked this conversation as resolved.
Show resolved Hide resolved

const canAddWaypoint = () => startPoint !== null && endPoint === null
const addWaypoint = canAddWaypoint()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const defaultText = [
"Turn-by-Turn Directions:",
"From Harvard St & Babcock St",
"Right on Babcock St.",
"Regular Route",
"Return to Regular Route",
"",
"Connection Points:",
"Harvard St @ Beacon St",
Expand Down
Loading