From 2ee3427645108a663c3a619f03c5ecccb6002b57 Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 17 Jul 2023 16:14:40 +0100 Subject: [PATCH] Added eventing for the onboarding:skipped. Added a redirect to the data section when skipping. Moved endRoute to the tour level config --- .../portal/onboarding/TourPopover.svelte | 38 ++++--------------- .../src/components/portal/onboarding/tours.js | 14 +++++-- .../builder/app/[application]/_layout.svelte | 7 ---- 3 files changed, 18 insertions(+), 41 deletions(-) diff --git a/packages/builder/src/components/portal/onboarding/TourPopover.svelte b/packages/builder/src/components/portal/onboarding/TourPopover.svelte index 4607150c29..d514441815 100644 --- a/packages/builder/src/components/portal/onboarding/TourPopover.svelte +++ b/packages/builder/src/components/portal/onboarding/TourPopover.svelte @@ -15,14 +15,15 @@ $: tourNodes = { ...$store.tourNodes } $: tourKey = $store.tourKey $: tourStepKey = $store.tourStepKey - $: tourOnSkip = TOURS[tourKey]?.onSkip + $: tour = TOURS[tourKey] + $: tourOnSkip = tour?.onSkip const updateTourStep = (targetStepKey, tourKey) => { if (!tourKey) { return } if (!tourSteps?.length) { - tourSteps = [...TOURS[tourKey].steps] + tourSteps = [...tour.steps] } tourStepIdx = getCurrentStepIdx(tourSteps, targetStepKey) lastStep = tourStepIdx + 1 == tourSteps.length @@ -73,23 +74,8 @@ tourStep.onComplete() } popover.hide() - if (tourStep.endRoute) { - $goto(tourStep.endRoute) - } - } - } - - const previousStep = async () => { - if (tourStepIdx > 0) { - let target = tourSteps[tourStepIdx - 1] - if (target) { - store.update(state => ({ - ...state, - tourStepKey: target.id, - })) - navigateStep(target) - } else { - console.log("Could not retrieve step") + if (tour.endRoute) { + $goto(tour.endRoute) } } } @@ -135,22 +121,14 @@