Skip to content

Commit

Permalink
tweak: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahpurcell committed Oct 18, 2024
1 parent 259cb9f commit 8e98a71
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
7 changes: 5 additions & 2 deletions assets/src/components/detours/diversionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export const DiversionPage = ({
: { input: useDetourProps.originalRoute }
)

const { route, routePattern, routePatterns, editedDetourText } = snapshot.context
const { route, routePattern, routePatterns, editedDetourText } =
snapshot.context
const routePatternsById = Object.fromEntries(
routePatterns?.map((rp) => [rp.id, rp]) ?? []
)
Expand Down Expand Up @@ -214,7 +215,9 @@ export const DiversionPage = ({
<DetourFinishedPanel
onNavigateBack={editDetour}
detourText={editedDetourText || ""}
onChangeDetourText={(detourText: string) => send({type: "detour.share.edit-directions", detourText})}
onChangeDetourText={(detourText: string) =>
send({ type: "detour.share.edit-directions", detourText })
}
onActivateDetour={
inTestGroup(TestGroups.DetoursList)
? () => {
Expand Down
26 changes: 18 additions & 8 deletions assets/src/models/createDetourMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,12 @@ export const createDetourMachine = setup({
Ok({
...event.output.detourShape,
directions: [
{ instruction: "From " + context.nearestIntersection },
{
instruction: "From " + context.nearestIntersection,
},
...event.output.detourShape.directions,
{ instruction: "Regular Route" }
]
{ instruction: "Regular Route" },
],
}),
}),
},
Expand All @@ -476,13 +478,20 @@ export const createDetourMachine = setup({
onDone: {
target: "Share Detour",
actions: assign({
editedDetourText: ({context}) => {
editedDetourText: ({ context }) => {
const routeName = context.route?.name
const routeDirection = context.routePattern && context.route?.directionNames[context.routePattern.directionId]
const routeDirection =
context.routePattern &&
context.route?.directionNames[
context.routePattern.directionId
]
const routeOrigin = context.routePattern?.name
const missedStops = context.finishedDetour?.missedStops

const detourShape = context.detourShape && isOk(context.detourShape) ? context.detourShape.ok : null
const detourShape =
context.detourShape && isOk(context.detourShape)
? context.detourShape.ok
: null

return [
`Detour ${routeName} ${routeDirection}`,
Expand All @@ -498,7 +507,8 @@ export const createDetourMachine = setup({
"Turn-by-Turn Directions:",
...(detourShape?.directions.map((v) => v.instruction) ?? []),
].join("\n")
}})
},
}),
},
},
"Share Detour": {
Expand All @@ -522,7 +532,7 @@ export const createDetourMachine = setup({
actions: assign({
editedDetourText: ({ event }) => event.detourText,
}),
}
},
},
},
Activating: {
Expand Down

0 comments on commit 8e98a71

Please sign in to comment.