feat: onboarding & profile edition (#507)
* feat: wip onboarding * fix: generate graphql front * wip: onboarding * feat: login/register and edit profile * fix: unused import * fix: test * Use DEBUG_MODE instead of STAGE and mute typescript depth exceed errors * Fix seeds * Fix onboarding when coming from google * Fix * Fix lint * Fix ci * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
25
front/src/modules/auth/utils/getOnboardingStatus.ts
Normal file
25
front/src/modules/auth/utils/getOnboardingStatus.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { CurrentUser } from '../states/currentUserState';
|
||||
|
||||
export enum OnboardingStatus {
|
||||
OngoingUserCreation = 'ongoing_user_creation',
|
||||
OngoingWorkspaceCreation = 'ongoing_workspace_creation',
|
||||
OngoingProfileCreation = 'ongoing_profile_creation',
|
||||
Completed = 'completed',
|
||||
}
|
||||
|
||||
export function getOnboardingStatus(
|
||||
isLoggedIn: boolean,
|
||||
currentUser: CurrentUser | null,
|
||||
) {
|
||||
if (!isLoggedIn || !currentUser) {
|
||||
return OnboardingStatus.OngoingUserCreation;
|
||||
}
|
||||
if (!currentUser.workspaceMember?.workspace.displayName) {
|
||||
return OnboardingStatus.OngoingWorkspaceCreation;
|
||||
}
|
||||
if (!currentUser.firstName || !currentUser.lastName) {
|
||||
return OnboardingStatus.OngoingProfileCreation;
|
||||
}
|
||||
|
||||
return OnboardingStatus.Completed;
|
||||
}
|
||||
Reference in New Issue
Block a user