From a63e79c8b40e05df35e10855792724f996eb7e25 Mon Sep 17 00:00:00 2001 From: Xiao Yijun Date: Fri, 24 Feb 2023 16:43:59 +0800 Subject: [PATCH] refactor(console): rename `cloudPage` to `onboardPage` (#3207) --- packages/console/src/cloud/pages/About/index.tsx | 8 ++++---- packages/console/src/cloud/pages/Congrats/index.tsx | 6 +++--- packages/console/src/cloud/pages/Onboard/index.tsx | 12 ++++++------ packages/console/src/cloud/pages/Welcome/index.tsx | 6 +++--- packages/console/src/cloud/types.ts | 2 +- packages/console/src/cloud/utils.ts | 5 +++-- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/packages/console/src/cloud/pages/About/index.tsx b/packages/console/src/cloud/pages/About/index.tsx index 322f27515..d1d50ac86 100644 --- a/packages/console/src/cloud/pages/About/index.tsx +++ b/packages/console/src/cloud/pages/About/index.tsx @@ -15,8 +15,8 @@ import TextInput from '@/components/TextInput'; import ActionBar from '../../components/ActionBar'; import { CardSelector, MultiCardSelector } from '../../components/CardSelector'; import type { Questionnaire } from '../../types'; -import { CloudPage } from '../../types'; -import { getCloudPagePathname } from '../../utils'; +import { OnboardPage } from '../../types'; +import { getOnboardPagePathname } from '../../utils'; import * as styles from './index.module.scss'; import { titleOptions, companySizeOptions, reasonOptions } from './options'; @@ -43,11 +43,11 @@ const About = () => { const onNext = async () => { await onSubmit(); - navigate(getCloudPagePathname(CloudPage.SignInExperience)); + navigate(getOnboardPagePathname(OnboardPage.SignInExperience)); }; const onBack = async () => { - navigate(getCloudPagePathname(CloudPage.Welcome)); + navigate(getOnboardPagePathname(OnboardPage.Welcome)); }; return ( diff --git a/packages/console/src/cloud/pages/Congrats/index.tsx b/packages/console/src/cloud/pages/Congrats/index.tsx index 0465b6b47..4d7fe4c0e 100644 --- a/packages/console/src/cloud/pages/Congrats/index.tsx +++ b/packages/console/src/cloud/pages/Congrats/index.tsx @@ -13,8 +13,8 @@ import Divider from '@/components/Divider'; import OverlayScrollbar from '@/components/OverlayScrollbar'; import { AppEndpointsContext } from '@/containers/AppEndpointsProvider'; -import { CloudPage } from '../../types'; -import { getCloudPagePathname } from '../../utils'; +import { OnboardPage } from '../../types'; +import { getOnboardPagePathname } from '../../utils'; import * as styles from './index.module.scss'; const Congrats = () => { @@ -28,7 +28,7 @@ const Congrats = () => { }; const handleBack = () => { - navigate(getCloudPagePathname(CloudPage.SignInExperience)); + navigate(getOnboardPagePathname(OnboardPage.SignInExperience)); }; return ( diff --git a/packages/console/src/cloud/pages/Onboard/index.tsx b/packages/console/src/cloud/pages/Onboard/index.tsx index 2b3b750b3..f0a2eed1a 100644 --- a/packages/console/src/cloud/pages/Onboard/index.tsx +++ b/packages/console/src/cloud/pages/Onboard/index.tsx @@ -2,8 +2,8 @@ import { conditional } from '@silverhand/essentials'; import { Navigate, Route, Routes } from 'react-router-dom'; import useUserOnboardingData from '@/cloud/hooks/use-user-onboarding-data'; -import { CloudPage } from '@/cloud/types'; -import { getCloudPagePathname } from '@/cloud/utils'; +import { OnboardPage } from '@/cloud/types'; +import { getOnboardPagePathname } from '@/cloud/utils'; import NotFound from '@/pages/NotFound'; import About from '../About'; @@ -11,7 +11,7 @@ import Congrats from '../Congrats'; import Welcome from '../Welcome'; import * as styles from './index.module.scss'; -const welcomePathname = getCloudPagePathname(CloudPage.Welcome); +const welcomePathname = getOnboardPagePathname(OnboardPage.Welcome); const Onboard = () => { const { @@ -27,15 +27,15 @@ const Onboard = () => {
} /> - } /> + } /> ) ?? } /> ) ?? } diff --git a/packages/console/src/cloud/pages/Welcome/index.tsx b/packages/console/src/cloud/pages/Welcome/index.tsx index 7f1a61e0f..d790134cd 100644 --- a/packages/console/src/cloud/pages/Welcome/index.tsx +++ b/packages/console/src/cloud/pages/Welcome/index.tsx @@ -14,8 +14,8 @@ import FormField from '@/components/FormField'; import OverlayScrollbar from '@/components/OverlayScrollbar'; import type { Questionnaire } from '../../types'; -import { CloudPage } from '../../types'; -import { getCloudPagePathname } from '../../utils'; +import { OnboardPage } from '../../types'; +import { getOnboardPagePathname } from '../../utils'; import * as styles from './index.module.scss'; import { deploymentTypeOptions, projectOptions } from './options'; @@ -45,7 +45,7 @@ const Welcome = () => { const onNext = async () => { await onSubmit(); - navigate(getCloudPagePathname(CloudPage.AboutUser)); + navigate(getOnboardPagePathname(OnboardPage.AboutUser)); }; return ( diff --git a/packages/console/src/cloud/types.ts b/packages/console/src/cloud/types.ts index 6dcf5a951..b7792a556 100644 --- a/packages/console/src/cloud/types.ts +++ b/packages/console/src/cloud/types.ts @@ -4,7 +4,7 @@ export enum CloudRoute { Onboard = 'onboard', } -export enum CloudPage { +export enum OnboardPage { Welcome = 'welcome', AboutUser = 'about-user', SignInExperience = 'sign-in-experience', diff --git a/packages/console/src/cloud/utils.ts b/packages/console/src/cloud/utils.ts index f12a4e9df..ce3838eaa 100644 --- a/packages/console/src/cloud/utils.ts +++ b/packages/console/src/cloud/utils.ts @@ -1,3 +1,4 @@ -import type { CloudPage } from './types'; +import type { OnboardPage } from './types'; +import { CloudRoute } from './types'; -export const getCloudPagePathname = (page: CloudPage) => `/cloud/${page}`; +export const getOnboardPagePathname = (page: OnboardPage) => `/${CloudRoute.Onboard}/${page}`;