Skip to content

Commit

Permalink
feat(ts/detourMachine): add fs-events for waypoints (#2882)
Browse files Browse the repository at this point in the history
  • Loading branch information
firestack authored Oct 25, 2024
1 parent 1b23ece commit 9712696
Showing 1 changed file with 34 additions and 18 deletions.
52 changes: 34 additions & 18 deletions assets/src/models/createDetourMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
fetchRoutePatterns,
} from "../api"
import { DetourShape, FinishedDetour } from "./detour"
import { fullStoryEvent } from "../helpers/fullStory"

export const createDetourMachine = setup({
types: {
Expand Down Expand Up @@ -348,12 +349,17 @@ export const createDetourMachine = setup({
on: {
"detour.edit.place-waypoint-on-route": {
target: "Place Waypoint",
actions: {
type: "detour.add-start-point",
params: ({ event: { location } }) => ({
location,
}),
},
actions: [
{
type: "detour.add-start-point",
params: ({ event: { location } }) => ({
location,
}),
},
() => {
fullStoryEvent("Placed Detour Start Point", {})
},
],
},
},
},
Expand Down Expand Up @@ -394,21 +400,31 @@ export const createDetourMachine = setup({
"detour.edit.place-waypoint": {
target: "Place Waypoint",
reenter: true,
actions: {
type: "detour.add-waypoint",
params: ({ event: { location } }) => ({
location,
}),
},
actions: [
{
type: "detour.add-waypoint",
params: ({ event: { location } }) => ({
location,
}),
},
() => {
fullStoryEvent("Placed Detour Way-Point", {})
},
],
},
"detour.edit.place-waypoint-on-route": {
target: "Finished Drawing",
actions: {
type: "detour.add-end-point",
params: ({ event: { location } }) => ({
location,
}),
},
actions: [
{
type: "detour.add-end-point",
params: ({ event: { location } }) => ({
location,
}),
},
() => {
fullStoryEvent("Placed Detour End Point", {})
},
],
},
"detour.edit.undo": [
{
Expand Down

0 comments on commit 9712696

Please sign in to comment.