Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update onboarding flow #41593

Merged
merged 10 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import ROUTES from '@src/ROUTES';
import INPUT_IDS from '@src/types/form/DisplayNameForm';
import type {BaseOnboardingPersonalDetailsOnyxProps, BaseOnboardingPersonalDetailsProps} from './types';

const OPEN_WORK_PAGE_PURPOSES = [CONST.ONBOARDING_CHOICES.MANAGE_TEAM];

function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNativeStyles, onboardingPurposeSelected}: BaseOnboardingPersonalDetailsProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand All @@ -51,12 +49,6 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
return;
}

if (OPEN_WORK_PAGE_PURPOSES.includes(onboardingPurposeSelected)) {
Navigation.navigate(ROUTES.ONBOARDING_WORK);

return;
}

Report.completeOnboarding(onboardingPurposeSelected, CONST.ONBOARDING_MESSAGES[onboardingPurposeSelected], {
login: currentUserPersonalDetails.login ?? '',
firstName,
Expand Down Expand Up @@ -121,7 +113,7 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
<View style={[styles.h100, styles.defaultModalContainer, shouldUseNativeStyles && styles.pt8]}>
<HeaderWithBackButton
shouldShowBackButton
progressBarPercentage={OPEN_WORK_PAGE_PURPOSES.includes(onboardingPurposeSelected ?? '') ? 50 : 75}
progressBarPercentage={75}
onBackButtonPress={Navigation.goBack}
/>
<KeyboardAvoidingView
Expand Down
5 changes: 5 additions & 0 deletions src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ function BaseOnboardingPurpose({shouldUseNativeStyles, shouldEnableMaxHeight, on
return;
}

if (selectedPurpose === CONST.ONBOARDING_CHOICES.MANAGE_TEAM) {
Navigation.navigate(ROUTES.ONBOARDING_WORK);
return;
}

Navigation.navigate(ROUTES.ONBOARDING_PERSONAL_DETAILS);
}, [selectedPurpose]);

Expand Down
10 changes: 9 additions & 1 deletion src/pages/OnboardingWork/BaseOnboardingWork.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import ROUTES from '@src/ROUTES';
import INPUT_IDS from '@src/types/form/WorkForm';
import type {BaseOnboardingWorkOnyxProps, BaseOnboardingWorkProps} from './types';

const OPEN_WORK_PAGE_PURPOSES = [CONST.ONBOARDING_CHOICES.MANAGE_TEAM];

function BaseOnboardingWork({currentUserPersonalDetails, shouldUseNativeStyles, onboardingPurposeSelected}: BaseOnboardingWorkProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand All @@ -41,6 +43,12 @@ function BaseOnboardingWork({currentUserPersonalDetails, shouldUseNativeStyles,
return;
}

if (OPEN_WORK_PAGE_PURPOSES.includes(onboardingPurposeSelected)) {
Navigation.navigate(ROUTES.ONBOARDING_PERSONAL_DETAILS);

return;
DylanDylann marked this conversation as resolved.
Show resolved Hide resolved
}

const work = values.work.trim();

const {adminsChatReportID} = Policy.createWorkspace(undefined, true, work);
Expand Down Expand Up @@ -96,7 +104,7 @@ function BaseOnboardingWork({currentUserPersonalDetails, shouldUseNativeStyles,
<View style={[styles.h100, styles.defaultModalContainer, shouldUseNativeStyles && styles.pt8]}>
<HeaderWithBackButton
shouldShowBackButton
progressBarPercentage={75}
progressBarPercentage={OPEN_WORK_PAGE_PURPOSES.includes(onboardingPurposeSelected ?? '') ? 50 : 75}
onBackButtonPress={Navigation.goBack}
/>
<KeyboardAvoidingView
Expand Down
Loading