From 607789d599c129f93f6e5dc144caaa38cfb32d67 Mon Sep 17 00:00:00 2001 From: Reto Aebersold Date: Thu, 9 Nov 2023 17:04:24 +0100 Subject: [PATCH] feat: onboarding course type --- .../components/onboarding/WizardSidePanel.vue | 18 +- client/src/components/ui/AvatarImage.vue | 2 +- .../onboarding/{uk => }/AccountConfirm.vue | 0 .../onboarding/{uk => }/AccountProfile.vue | 17 +- .../onboarding/{uk => }/AccountSetup.vue | 7 - client/src/pages/onboarding/WizardBase.vue | 40 ++++ client/src/pages/onboarding/uk/WizardBase.vue | 10 - .../pages/onboarding/vv/CheckoutAddress.vue | 177 ++++++++++++++++++ client/src/router/index.ts | 23 +-- client/src/router/onboarding.ts | 6 +- 10 files changed, 255 insertions(+), 45 deletions(-) rename client/src/pages/onboarding/{uk => }/AccountConfirm.vue (100%) rename client/src/pages/onboarding/{uk => }/AccountProfile.vue (85%) rename client/src/pages/onboarding/{uk => }/AccountSetup.vue (72%) create mode 100644 client/src/pages/onboarding/WizardBase.vue delete mode 100644 client/src/pages/onboarding/uk/WizardBase.vue create mode 100644 client/src/pages/onboarding/vv/CheckoutAddress.vue diff --git a/client/src/components/onboarding/WizardSidePanel.vue b/client/src/components/onboarding/WizardSidePanel.vue index e6a8ad49..4b77e52c 100644 --- a/client/src/components/onboarding/WizardSidePanel.vue +++ b/client/src/components/onboarding/WizardSidePanel.vue @@ -4,14 +4,15 @@ import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue"; import type { AvailableLanguages } from "@/stores/user"; import { useUserStore } from "@/stores/user"; -const props = defineProps({ - courseName: String, -}); +const props = defineProps<{ + courseName: string; + imageUrl: string; +}>(); const userStore = useUserStore(); async function changeLocale(language: AvailableLanguages) { - userStore.setUserLanguages(language); + await userStore.setUserLanguages(language); } diff --git a/client/src/pages/onboarding/WizardBase.vue b/client/src/pages/onboarding/WizardBase.vue new file mode 100644 index 00000000..5dc70552 --- /dev/null +++ b/client/src/pages/onboarding/WizardBase.vue @@ -0,0 +1,40 @@ + + + diff --git a/client/src/pages/onboarding/uk/WizardBase.vue b/client/src/pages/onboarding/uk/WizardBase.vue deleted file mode 100644 index dc8dd1a8..00000000 --- a/client/src/pages/onboarding/uk/WizardBase.vue +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/client/src/pages/onboarding/vv/CheckoutAddress.vue b/client/src/pages/onboarding/vv/CheckoutAddress.vue new file mode 100644 index 00000000..ea6ac166 --- /dev/null +++ b/client/src/pages/onboarding/vv/CheckoutAddress.vue @@ -0,0 +1,177 @@ + + + diff --git a/client/src/router/index.ts b/client/src/router/index.ts index 05204a12..ea623ec7 100644 --- a/client/src/router/index.ts +++ b/client/src/router/index.ts @@ -7,7 +7,7 @@ import { updateLoggedIn, } from "@/router/guards"; import { addToHistory } from "@/router/history"; -import { checkUKProcess } from "@/router/onboarding"; +import { onboardingRedirect } from "@/router/onboarding"; import { createRouter, createWebHistory } from "vue-router"; const router = createRouter({ @@ -231,39 +231,40 @@ const router = createRouter({ component: () => import("@/pages/AppointmentsPage.vue"), }, { - path: "/onboarding/uk", + path: "/onboarding/:courseType", props: true, - component: () => import("@/pages/onboarding/uk/WizardBase.vue"), + component: () => import("@/pages/onboarding/WizardBase.vue"), meta: { public: true, hideChrome: true, }, - beforeEnter: checkUKProcess, + beforeEnter: onboardingRedirect, children: [ { path: "account/create", - props: true, - component: () => import("@/pages/onboarding/uk/AccountSetup.vue"), + component: () => import("@/pages/onboarding/AccountSetup.vue"), name: "accountCreate", }, { path: "account/confirm", - props: true, - component: () => import("@/pages/onboarding/uk/AccountConfirm.vue"), + component: () => import("@/pages/onboarding/AccountConfirm.vue"), name: "accountConfirm", }, { path: "account/profile", - props: true, - component: () => import("@/pages/onboarding/uk/AccountProfile.vue"), + component: () => import("@/pages/onboarding/AccountProfile.vue"), name: "accountProfile", }, { path: "account/complete", - props: true, component: () => import("@/pages/onboarding/uk/SetupComplete.vue"), name: "setupComplete", }, + { + path: "checkout/address", + component: () => import("@/pages/onboarding/vv/CheckoutAddress.vue"), + name: "checkoutAddress", + }, ], }, { diff --git a/client/src/router/onboarding.ts b/client/src/router/onboarding.ts index 06c840d8..d1a986b8 100644 --- a/client/src/router/onboarding.ts +++ b/client/src/router/onboarding.ts @@ -1,7 +1,7 @@ import { useUserStore } from "@/stores/user"; import type { NavigationGuardNext, RouteLocationNormalized } from "vue-router"; -export async function checkUKProcess( +export async function onboardingRedirect( to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext @@ -11,14 +11,14 @@ export async function checkUKProcess( // Guest if (!userStore.loggedIn) { if (to.name !== "accountCreate") { - return next({ name: "accountCreate" }); + return next({ name: "accountCreate", params: to.params }); } return next(); } // Logged in if (to.name === "accountCreate") { - return next({ name: "accountConfirm" }); + return next({ name: "accountConfirm", params: to.params }); } return next();