Skip to content

Commit

Permalink
wip!
Browse files Browse the repository at this point in the history
  • Loading branch information
firestack committed Oct 23, 2024
5 parents a395c98 + 8ae8215 + 8cb542f + f8066b4 + 4e806df commit f707e0e
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 20 deletions.
2 changes: 1 addition & 1 deletion assets/src/components/detours/activateDetourModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const SurroundingModal = ({
Cancel
</Button>
{onActivate ? (
<Button variant="primary" onClick={onActivate}>
<Button variant="primary" onClick={onActivate} data-fs-element="Activate Detour">
Activate detour
</Button>
) : (
Expand Down
1 change: 1 addition & 0 deletions assets/src/components/detours/deactivateDetourModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const DeactivateDetourModal = ({
variant="ui-alert"
onClick={onDeactivate}
className="text-white"
data-fs-element="Confirm Return to Regular Route"
>
Return to regular route
</Button>
Expand Down
2 changes: 2 additions & 0 deletions assets/src/components/detours/detourMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export const DetourMap = ({
onClick={onUndo}
size="lg"
title="Undo"
data-fs-element="Undo"
>
<ArrowLeftSquare />
</MapButton>
Expand All @@ -189,6 +190,7 @@ export const DetourMap = ({
onClick={onClear}
size="lg"
title="Clear"
data-fs-element="Clear"
>
<XSquare />
</MapButton>
Expand Down
1 change: 1 addition & 0 deletions assets/src/components/detours/detourPanelComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const CopyButton = ({ detourText }: { detourText: string }) => (
variant="outline-primary"
size="sm"
onClick={() => window.navigator.clipboard?.writeText(detourText)}
data-fs-element="Copy Details"
>
<Files />
Copy details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const ActiveDetourPanel = ({
variant="ui-alert"
className="flex-grow-1 m-3 icon-link text-light justify-content-center"
onClick={onOpenDeactivateModal}
data-fs-element="Return to Regular Route"
>
<StopCircle />
Return to regular route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export const DetourFinishedPanel = ({
onActivateDetour,
children,
}: DetourFinishedPanelProps) => (
<Panel as="article" className="c-diversion-panel">
<Panel
as="article"
className="c-diversion-panel"
data-fs-element="Activate Panel"
>
<Panel.Header>
<h1 className="c-diversion-panel__h1 my-3">View Draft Detour</h1>
<CopyButton detourText={detourText} />
Expand All @@ -43,6 +47,7 @@ export const DetourFinishedPanel = ({
style={{
resize: "none",
}}
data-fs-element="Detour Text"
/>
</Panel.Body.ScrollArea>

Expand All @@ -51,6 +56,7 @@ export const DetourFinishedPanel = ({
<Button
className="m-3 flex-grow-1 icon-link justify-content-center"
onClick={onActivateDetour}
data-fs-element="Activate"
>
<BsIcons.Power />
Start Detour
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export const DetourRouteSelectionPanel = ({
<Button
className="m-3 flex-grow-1 icon-link justify-content-center"
onClick={onConfirm}
data-fs-element="Start Drawing"
>
<Brush />
Start drawing detour
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const DrawDetourPanel = ({
<Button
className="flex-grow-1 m-3 icon-link justify-content-center"
onClick={onReviewDetour}
data-fs-element="Review"
>
<CardChecklist />
Review
Expand Down
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 f707e0e

Please sign in to comment.