Line data Source code
1 : import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
2 : import { computed } from 'vue'
3 : import type { ComputedRef } from 'vue'
4 :
5 : import { useAppMode } from '@/composables/useAppMode'
6 : import { useAppModeStore } from '@/stores/appModeStore'
7 :
8 : import type { EntryPath } from './onboardingTours'
9 :
10 : export interface TourTrigger {
11 : holds: ComputedRef<boolean>
12 : autoOpen: ComputedRef<boolean>
13 : }
14 :
15 : /** Each tour's auto-open condition, paired with its entry path. */
16 2355 : export function useTourTriggers(): [EntryPath, TourTrigger][] {
17 2355 : const { mode } = useAppMode()
18 2355 : const appModeStore = useAppModeStore()
19 2355 : const desktopLayout = useBreakpoints(breakpointsTailwind).greaterOrEqual('md')
20 2355 : const inAppMode = computed(() => desktopLayout.value && mode.value === 'app')
21 2355 : return [
22 : [
23 : 'appMode',
24 : {
25 : holds: inAppMode,
26 : autoOpen: computed(() => inAppMode.value && appModeStore.hasOutputs)
27 : }
28 : ]
29 : ]
30 : }
|