-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial pass at FTUE state management.
- Loading branch information
1 parent
1391d7d
commit e77705b
Showing
7 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
{{ t('text.googlePermissionDisclaimer') }} | ||
</template> | ||
|
||
<script setup> | ||
import { useI18n } from 'vue-i18n'; | ||
const { t } = useI18n(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script setup> | ||
</script> | ||
|
||
<template> | ||
<label> | ||
Full Name | ||
<input type="text"/> | ||
</label> | ||
<label> | ||
Username | ||
<input type="text"/> | ||
</label> | ||
<label> | ||
Timezone | ||
<input type="text"/> | ||
</label> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<template> | ||
<div | ||
class="mdl-overlay-close fixed left-0 top-0 z-40 h-screen w-screen bg-gray-800/50" | ||
></div> | ||
<div | ||
class="position-center fixed z-50 flex w-full max-w-lg flex-col items-center gap-6 rounded-xl bg-white p-12 dark:bg-gray-700" | ||
> | ||
<div class="text-2xl font-semibold text-teal-500"> | ||
{{ stepTitle }} | ||
</div> | ||
<ftue-view/> | ||
<div class="flex gap-4"> | ||
<secondary-button | ||
v-if="hasPreviousStep" | ||
class="btn-close" | ||
label="Back" | ||
@click="previousStep()" | ||
title="Back" | ||
/> | ||
<primary-button | ||
v-if="hasNextStep" | ||
class="btn-copy" | ||
label="Continue" | ||
title="Continue" | ||
@click="nextStep()" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import PrimaryButton from '@/elements/PrimaryButton.vue'; | ||
import { IconX } from '@tabler/icons-vue'; | ||
import SecondaryButton from '@/elements/SecondaryButton.vue'; | ||
import ArtConfetti from '@/elements/arts/ArtConfetti.vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
import SetupProfile from '@/components/FTUE/SetupProfile.vue'; | ||
import { useFTUEStore } from '@/stores/ftue-store'; | ||
import { storeToRefs } from 'pinia'; | ||
const ftueStore = useFTUEStore(); | ||
const { previousStep, nextStep } = ftueStore; | ||
const { | ||
ftueView, hasPreviousStep, hasNextStep, stepTitle, | ||
} = storeToRefs(ftueStore); | ||
const { t } = useI18n(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { defineStore } from 'pinia'; | ||
import { ref, computed, defineAsyncComponent } from 'vue'; | ||
import { useLocalStorage } from '@vueuse/core'; | ||
import { ftueStep } from '@/definitions'; | ||
|
||
const initialObject = { | ||
// First step | ||
step: ftueStep.setupProfile, | ||
previousStep: ftueStep.setupProfile, | ||
nextStep: ftueStep.googlePermissions, | ||
}; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const useFTUEStore = defineStore('FTUE', () => { | ||
// State | ||
const data = useLocalStorage('tba/ftue', structuredClone(initialObject)); | ||
|
||
const stepList = { | ||
[ftueStep.setupProfile]: { | ||
previous: null, | ||
next: ftueStep.googlePermissions, | ||
title: 'Setup your profile', | ||
component: defineAsyncComponent({ | ||
loader: () => import('@/components/FTUE/SetupProfile.vue'), | ||
}), | ||
}, | ||
[ftueStep.googlePermissions]: { | ||
previous: ftueStep.setupProfile, | ||
next: ftueStep.connectCalendars, | ||
title: 'Allow Google Calendar permissions', | ||
component: defineAsyncComponent({ | ||
loader: () => import('@/components/FTUE/GooglePermissions.vue'), | ||
}), | ||
}, | ||
[ftueStep.connectCalendars]: { | ||
previous: ftueStep.googlePermissions, | ||
next: ftueStep.setupSchedule, | ||
title: 'Connect calendars', | ||
component: defineAsyncComponent({ | ||
loader: () => import('@/components/FTUE/GooglePermissions.vue'), | ||
}), | ||
}, | ||
[ftueStep.setupSchedule]: { | ||
previous: ftueStep.connectCalendars, | ||
next: ftueStep.connectVideoConferencing, | ||
title: 'Create schedule', | ||
component: defineAsyncComponent({ | ||
loader: () => import('@/components/FTUE/GooglePermissions.vue'), | ||
}), | ||
}, | ||
[ftueStep.connectVideoConferencing]: { | ||
previous: ftueStep.setupSchedule, | ||
next: ftueStep.finish, | ||
title: 'Connect video', | ||
component: defineAsyncComponent({ | ||
loader: () => import('@/components/FTUE/GooglePermissions.vue'), | ||
}), | ||
}, | ||
[ftueStep.finish]: { | ||
previous: ftueStep.connectVideoConferencing, | ||
next: null, | ||
title: 'You are set to go!', | ||
component: defineAsyncComponent({ | ||
loader: () => import('@/components/FTUE/GooglePermissions.vue'), | ||
}), | ||
}, | ||
}; | ||
|
||
const ftueView = computed(() => { | ||
if (!stepList[data.value.step]) { | ||
// This should be an error component | ||
return defineAsyncComponent({ | ||
loader: () => import('@/components/FTUE/SetupProfile.vue'), | ||
}); | ||
} | ||
|
||
return stepList[data.value.step].component; | ||
}); | ||
|
||
const hasNextStep = computed(() => !!(stepList[data.value.step] && stepList[data.value.step].next)); | ||
const hasPreviousStep = computed(() => !!(stepList[data.value.step] && stepList[data.value.step].previous)); | ||
const stepTitle = computed(() => { | ||
if (stepList[data.value.step]) { | ||
return stepList[data.value.step].title; | ||
} | ||
}); | ||
|
||
const nextStep = () => { | ||
if (hasNextStep.value) { | ||
data.value.step = stepList[data.value.step].next; | ||
} | ||
}; | ||
|
||
const previousStep = () => { | ||
if (hasPreviousStep.value) { | ||
data.value.step = stepList[data.value.step].previous; | ||
} | ||
}; | ||
|
||
return { | ||
data, ftueView, nextStep, previousStep, hasNextStep, hasPreviousStep, stepTitle, | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters