opsdash-app/opsdash/composables/useOnboardingWizardState.ts
2026-03-23 19:31:02 +07:00

29 lines
855 B
TypeScript

import { computed, nextTick, ref } from 'vue'
export type StepId = 'intro' | 'strategy' | 'calendars' | 'deck' | 'goals' | 'preferences' | 'dashboard' | 'review'
export function createOnboardingWizardState() {
const autoWizardNeeded = ref(false)
const manualWizardOpen = ref(false)
const onboardingRunId = ref(0)
const wizardStartStep = ref<StepId | null>(null)
const onboardingWizardVisible = computed(() => autoWizardNeeded.value || manualWizardOpen.value)
async function openWizardFromSidebar(step?: StepId) {
onboardingRunId.value += 1
wizardStartStep.value = step ?? null
autoWizardNeeded.value = false
manualWizardOpen.value = true
await nextTick()
}
return {
autoWizardNeeded,
manualWizardOpen,
onboardingRunId,
onboardingWizardVisible,
openWizardFromSidebar,
wizardStartStep,
}
}