5623 add an inviteteam onboarding step (#5769)

## Changes
- add a new invite Team onboarding step
- update currentUser.state to currentUser.onboardingStep

## Edge cases
We will never display invite team onboarding step 
- if number of workspaceMember > 1
- if a workspaceMember as been deleted

## Important changes
Update typeorm package version to 0.3.20 because we needed a fix on
`indexPredicates` pushed in 0.3.20 version
(https://github.com/typeorm/typeorm/issues/10191)

## Result
<img width="844" alt="image"
src="https://github.com/twentyhq/twenty/assets/29927851/0dab54cf-7c66-4c64-b0c9-b0973889a148">



https://github.com/twentyhq/twenty/assets/29927851/13268d0a-cfa7-42a4-84c6-9e1fbbe48912
This commit is contained in:
martmull
2024-06-12 21:13:18 +02:00
committed by GitHub
parent 2fdd2f4949
commit 3986824017
60 changed files with 1009 additions and 372 deletions

View File

@ -1,21 +1,25 @@
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { useSetRecoilState } from 'recoil';
import { useRecoilValue } from 'recoil';
import { Key } from 'ts-key-enum';
import { IconGoogle } from 'twenty-ui';
import { SubTitle } from '@/auth/components/SubTitle';
import { Title } from '@/auth/components/Title';
import { isCurrentUserLoadedState } from '@/auth/states/isCurrentUserLoadingState';
import { currentUserState } from '@/auth/states/currentUserState';
import { OnboardingSyncEmailsSettingsCard } from '@/onboarding/components/OnboardingSyncEmailsSettingsCard';
import { useSetNextOnboardingStep } from '@/onboarding/hooks/useSetNextOnboardingStep';
import { useTriggerGoogleApisOAuth } from '@/settings/accounts/hooks/useTriggerGoogleApisOAuth';
import { AppPath } from '@/types/AppPath';
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
import { MainButton } from '@/ui/input/button/components/MainButton';
import { ActionLink } from '@/ui/navigation/link/components/ActionLink';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import {
CalendarChannelVisibility,
MessageChannelVisibility,
OnboardingStep,
useSkipSyncEmailOnboardingStepMutation,
} from '~/generated/graphql';
@ -35,9 +39,9 @@ const StyledActionLinkContainer = styled.div`
export const SyncEmails = () => {
const theme = useTheme();
const navigate = useNavigate();
const { triggerGoogleApisOAuth } = useTriggerGoogleApisOAuth();
const setIsCurrentUserLoaded = useSetRecoilState(isCurrentUserLoadedState);
const setNextOnboardingStep = useSetNextOnboardingStep();
const currentUser = useRecoilValue(currentUserState);
const [visibility, setVisibility] = useState<MessageChannelVisibility>(
MessageChannelVisibility.ShareEverything,
);
@ -59,15 +63,25 @@ export const SyncEmails = () => {
const continueWithoutSync = async () => {
await skipSyncEmailOnboardingStepMutation();
setIsCurrentUserLoaded(false);
navigate(AppPath.Index);
setNextOnboardingStep(OnboardingStep.SyncEmail);
};
const isSubmitting = false;
useScopedHotkeys(
[Key.Enter],
async () => {
await continueWithoutSync();
},
PageHotkeyScope.SyncEmail,
[continueWithoutSync],
);
if (currentUser?.onboardingStep !== OnboardingStep.SyncEmail) {
return <></>;
}
return (
<>
<Title withMarginTop={false}>Emails and Calendar</Title>
<Title noMarginTop>Emails and Calendar</Title>
<SubTitle>
Sync your Emails and Calendar with Twenty. Choose your privacy settings.
</SubTitle>
@ -82,7 +96,6 @@ export const SyncEmails = () => {
onClick={handleButtonClick}
width={200}
Icon={() => <IconGoogle size={theme.icon.size.sm} />}
disabled={isSubmitting}
/>
<StyledActionLinkContainer>
<ActionLink onClick={continueWithoutSync}>