Improve onboarding experience (#12824)
https://github.com/user-attachments/assets/365c1618-e9d5-46d5-9b54-bed2cdeb7c02
This commit is contained in:
@ -5,9 +5,11 @@ import { Controller, SubmitHandler, useForm } from 'react-hook-form';
|
|||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
import { Logo } from '@/auth/components/Logo';
|
||||||
import { SubTitle } from '@/auth/components/SubTitle';
|
import { SubTitle } from '@/auth/components/SubTitle';
|
||||||
import { Title } from '@/auth/components/Title';
|
import { Title } from '@/auth/components/Title';
|
||||||
import { useAuth } from '@/auth/hooks/useAuth';
|
import { useAuth } from '@/auth/hooks/useAuth';
|
||||||
|
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||||
import { useRefreshObjectMetadataItems } from '@/object-metadata/hooks/useRefreshObjectMetadataItem';
|
import { useRefreshObjectMetadataItems } from '@/object-metadata/hooks/useRefreshObjectMetadataItem';
|
||||||
import { useSetNextOnboardingStatus } from '@/onboarding/hooks/useSetNextOnboardingStatus';
|
import { useSetNextOnboardingStatus } from '@/onboarding/hooks/useSetNextOnboardingStatus';
|
||||||
import { WorkspaceLogoUploader } from '@/settings/workspace/components/WorkspaceLogoUploader';
|
import { WorkspaceLogoUploader } from '@/settings/workspace/components/WorkspaceLogoUploader';
|
||||||
@ -16,7 +18,9 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
|||||||
import { TextInputV2 } from '@/ui/input/components/TextInputV2';
|
import { TextInputV2 } from '@/ui/input/components/TextInputV2';
|
||||||
import { Modal } from '@/ui/layout/modal/components/Modal';
|
import { Modal } from '@/ui/layout/modal/components/Modal';
|
||||||
import { Trans, useLingui } from '@lingui/react/macro';
|
import { Trans, useLingui } from '@lingui/react/macro';
|
||||||
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared/utils';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
import { H2Title } from 'twenty-ui/display';
|
import { H2Title } from 'twenty-ui/display';
|
||||||
import { Loader } from 'twenty-ui/feedback';
|
import { Loader } from 'twenty-ui/feedback';
|
||||||
@ -36,6 +40,15 @@ const StyledButtonContainer = styled.div`
|
|||||||
width: 200px;
|
width: 200px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const StyledLoaderContainer = styled.div`
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: ${({ theme }) => theme.spacing(8)};
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: ${({ theme }) => theme.spacing(8)};
|
||||||
|
`;
|
||||||
|
|
||||||
enum PendingCreationLoaderStep {
|
enum PendingCreationLoaderStep {
|
||||||
None = 'none',
|
None = 'none',
|
||||||
Step1 = 'step-1',
|
Step1 = 'step-1',
|
||||||
@ -44,7 +57,6 @@ enum PendingCreationLoaderStep {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const StyledPendingCreationLoader = styled(motion.div)`
|
const StyledPendingCreationLoader = styled(motion.div)`
|
||||||
height: 388px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -62,6 +74,7 @@ export const CreateWorkspace = () => {
|
|||||||
const [pendingCreationLoaderStep, setPendingCreationLoaderStep] = useState(
|
const [pendingCreationLoaderStep, setPendingCreationLoaderStep] = useState(
|
||||||
PendingCreationLoaderStep.None,
|
PendingCreationLoaderStep.None,
|
||||||
);
|
);
|
||||||
|
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||||
|
|
||||||
const validationSchema = z
|
const validationSchema = z
|
||||||
.object({
|
.object({
|
||||||
@ -140,26 +153,36 @@ export const CreateWorkspace = () => {
|
|||||||
<Modal.Content isVerticalCentered isHorizontalCentered>
|
<Modal.Content isVerticalCentered isHorizontalCentered>
|
||||||
{pendingCreationLoaderStep !== PendingCreationLoaderStep.None && (
|
{pendingCreationLoaderStep !== PendingCreationLoaderStep.None && (
|
||||||
<>
|
<>
|
||||||
|
<Logo
|
||||||
|
primaryLogo={
|
||||||
|
isNonEmptyString(currentWorkspace?.logo)
|
||||||
|
? currentWorkspace?.logo
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Title>
|
||||||
|
<Trans>Creating your workspace</Trans>
|
||||||
|
</Title>
|
||||||
<StyledPendingCreationLoader>
|
<StyledPendingCreationLoader>
|
||||||
{pendingCreationLoaderStep === PendingCreationLoaderStep.Step1 && (
|
{pendingCreationLoaderStep === PendingCreationLoaderStep.Step1 && (
|
||||||
<Title animate>
|
<SubTitle>
|
||||||
<Loader color="gray" />
|
<Trans>Setting up your database...</Trans>
|
||||||
<Trans>Setting up your database</Trans>
|
</SubTitle>
|
||||||
</Title>
|
|
||||||
)}
|
)}
|
||||||
{pendingCreationLoaderStep === PendingCreationLoaderStep.Step2 && (
|
{pendingCreationLoaderStep === PendingCreationLoaderStep.Step2 && (
|
||||||
<Title animate>
|
<SubTitle>
|
||||||
<Loader color="gray" />
|
<Trans>Creating your data model...</Trans>
|
||||||
<Trans>Creating your schema</Trans>
|
</SubTitle>
|
||||||
</Title>
|
|
||||||
)}
|
)}
|
||||||
{pendingCreationLoaderStep === PendingCreationLoaderStep.Step3 && (
|
{pendingCreationLoaderStep === PendingCreationLoaderStep.Step3 && (
|
||||||
<Title animate>
|
<SubTitle>
|
||||||
<Loader color="gray" />
|
<Trans>Prefilling your workspace data...</Trans>
|
||||||
<Trans>Prefilling your workspace data</Trans>
|
</SubTitle>
|
||||||
</Title>
|
|
||||||
)}
|
)}
|
||||||
</StyledPendingCreationLoader>
|
</StyledPendingCreationLoader>
|
||||||
|
<StyledLoaderContainer>
|
||||||
|
<Loader color="gray" />
|
||||||
|
</StyledLoaderContainer>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{pendingCreationLoaderStep === PendingCreationLoaderStep.None && (
|
{pendingCreationLoaderStep === PendingCreationLoaderStep.None && (
|
||||||
|
|||||||
Reference in New Issue
Block a user