Tutorials improvement (#2384)

* fix(frontend): fix tutorials

* fix(frontend): simplify

* fix(frontend): simplify

* fix(frontend): fix skip all

* fix(frontend): fix toggle

* fix(frontend): simplify
This commit is contained in:
Faton Ramadani
2023-10-04 14:28:37 +02:00
committed by GitHub
parent 63ad53fa70
commit e36d21f15f
12 changed files with 251 additions and 152 deletions

View File

@@ -3,25 +3,28 @@
import 'driver.js/dist/driver.css'
import { createEventDispatcher, getContext } from 'svelte'
import type { FlowEditorContext } from '../flows/types'
import TutorialItem from './TutorialItem.svelte'
import { emptyFlowModuleState } from '../flows/utils'
import {
clickButtonBySelector,
setInputBySelector,
triggerAddFlowStep,
selectFlowStepKind,
selectOptionsBySelector
selectOptionsBySelector,
tainted
} from './utils'
import { updateProgress } from '$lib/tutorialUtils'
export let shouldRenderButton: boolean = true
const { flowStore, selectedId, flowStateStore } =
getContext<FlowEditorContext>('FlowEditorContext')
const dispatch = createEventDispatcher()
export function runTutorial() {
if (tainted($flowStore)) {
dispatch('error', { detail: 'forloop' })
return
}
const forloopTutorial = driver({
showProgress: true,
allowClose: true,
@@ -405,12 +408,3 @@
forloopTutorial.drive()
}
</script>
{#if shouldRenderButton}
<TutorialItem
on:click={() => runTutorial()}
label="For loops tutorial"
index={1}
id="flow-builder-tutorial-forloops"
/>
{/if}