Skip to content

Commit

Permalink
feat(ts/detour/fs-element-steps): add element labels to next step in …
Browse files Browse the repository at this point in the history
…activate modal
  • Loading branch information
firestack committed Oct 29, 2024
1 parent 9dfb933 commit 9e98f3c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion assets/src/components/detours/activateDetourModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ interface SurroundingModalProps extends PropsWithChildren {
onActivate?: () => void
}

interface FSElementProps {
nextStepLabel: string | undefined
}

const SurroundingModal = ({
onCancel,
onNext,
onBack,
onActivate,
children,
}: SurroundingModalProps) => (
nextStepLabel,
}: SurroundingModalProps & FSElementProps) => (
<Modal show animation={false} onHide={onCancel}>
<Modal.Header closeButton>
<h3 className="fs-3 fw-semibold lh-sm my-1">Start detour</h3>
Expand Down Expand Up @@ -78,6 +83,7 @@ const SurroundingModal = ({
variant="primary"
disabled={onNext === undefined}
onClick={onNext}
data-fs-element={nextStepLabel}
>
Next
</Button>
Expand Down
15 changes: 15 additions & 0 deletions assets/src/components/detours/diversionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ export const DiversionPage = ({
},
}) ? (
<ActivateDetour.Modal
nextStepLabel={
(snapshot.matches({
"Detour Drawing": {
"Share Detour": { Activating: "Selecting Duration" },
},
}) &&
"Select Duration") ||
(snapshot.matches({
"Detour Drawing": {
"Share Detour": { Activating: "Selecting Reason" },
},
}) &&
"Select Reason") ||
undefined
}
onCancel={() => {
send({ type: "detour.share.activate-modal.cancel" })
}}
Expand Down

0 comments on commit 9e98f3c

Please sign in to comment.