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

Join Community Sign Up #2310

Merged
merged 4 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions src/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import {
SIGN_IN_FLOW,
SIGN_UP_FLOW,
CREATE_COMMUNITY_UNAUTHENTICATED_FLOW,
JOIN_COMMUNITY_UNAUTHENTICATED_FLOW,
COMPLETE_STEP_FLOW_NAVIGATE_BACK,
ADD_MY_STEP_FLOW,
ADD_PERSON_STEP_FLOW,
Expand Down Expand Up @@ -138,6 +139,7 @@ import {
VideoFullScreen,
VIDEO_FULL_SCREEN,
} from './containers/VideoFullScreen';
import { JoinCommunityUnauthenticatedFlowNavigator } from './routes/groups/joinCommunityUnauthenticatedFlow';

// Do custom animations between pages
// import CardStackStyleInterpolator from 'react-navigation/src/views/CardStack/CardStackStyleInterpolator';
Expand Down Expand Up @@ -283,6 +285,7 @@ const screens = {
[SIGN_IN_FLOW]: SignInFlowNavigator,
[SIGN_UP_FLOW]: SignUpFlowNavigator,
[CREATE_COMMUNITY_UNAUTHENTICATED_FLOW]: CreateCommunityUnauthenticatedFlowNavigator,
[JOIN_COMMUNITY_UNAUTHENTICATED_FLOW]: JoinCommunityUnauthenticatedFlowNavigator,
[JOIN_BY_CODE_FLOW]: JoinByCodeFlowNavigator,
[JOIN_BY_CODE_ONBOARDING_FLOW]: JoinByCodeOnboardingFlowNavigator,
[ADD_SOMEONE_ONBOARDING_FLOW]: AddSomeoneOnboardingFlowNavigator,
Expand Down
6 changes: 6 additions & 0 deletions src/containers/Auth/SignUpScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import styles from './styles';

export const SIGNUP_TYPES = {
CREATE_COMMUNITY: 'login/CREATE_COMMUNITY',
JOIN_COMMUNITY: 'login/JOIN_COMMUNITY',
SETTINGS_MENU: 'login/SIDE_MENU',
};

Expand All @@ -48,6 +49,11 @@ const headerContentOptions: {
title: i18Next.t('loginOptions:createCommunityTitle'),
description: i18Next.t('loginOptions:createCommunityDescription'),
},
[SIGNUP_TYPES.JOIN_COMMUNITY]: {
image: PEOPLE,
title: i18Next.t('loginOptions:joinCommunityTitle'),
description: i18Next.t('loginOptions:joinCommunityDescription'),
},
};

const SignUpScreen = ({
Expand Down
9 changes: 8 additions & 1 deletion src/containers/Groups/GroupsListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import { ACTIONS, GLOBAL_COMMUNITY_ID } from '../../constants';
import {
CREATE_COMMUNITY_UNAUTHENTICATED_FLOW,
JOIN_COMMUNITY_UNAUTHENTICATED_FLOW,
JOIN_BY_CODE_FLOW,
} from '../../routes/constants';
import { useRefreshing } from '../../utils/hooks/useRefreshing';
Expand Down Expand Up @@ -195,7 +196,13 @@
};

const join = () => {
dispatch(navigatePush(JOIN_BY_CODE_FLOW));
dispatch(
navigatePush(
isAnonymousUser
? JOIN_COMMUNITY_UNAUTHENTICATED_FLOW

Check warning on line 202 in src/containers/Groups/GroupsListScreen.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/Groups/GroupsListScreen.tsx#L202

Added line #L202 was not covered by tests
: JOIN_BY_CODE_FLOW,
),
);
};

const create = () => {
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ export default {
member: 'Already a Member?',
createCommunityTitle: 'Create a Community',
createCommunityDescription: 'Sign Up to create a MissionHub community.',
joinCommunityTitle: 'Join a Community',
joinCommunityDescription: 'Sign Up to join a MissionHub community.',
},
keyLogin: {
emailLabel: 'Email',
Expand Down
2 changes: 2 additions & 0 deletions src/routes/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const SIGN_IN_FLOW = 'nav/SIGN_IN_FLOW';
export const SIGN_UP_FLOW = 'nav/SIGN_UP_FLOW';
export const CREATE_COMMUNITY_UNAUTHENTICATED_FLOW =
'nav/CREATE_COMMUNITY_UNAUTHENTICATED_FLOW';
export const JOIN_COMMUNITY_UNAUTHENTICATED_FLOW =
'nav/JOIN_COMMUNITY_UNAUTHENTICATED_FLOW';
export const JOIN_BY_CODE_FLOW = 'nav/JOIN_BY_CODE_FLOW';
export const JOIN_BY_CODE_ONBOARDING_FLOW = 'nav/JOIN_BY_CODE_ONBOARDING_FLOW';
export const ADD_SOMEONE_ONBOARDING_FLOW = 'nav/ADD_SOMEONE_ONBOARDING_FLOW';
Expand Down
29 changes: 29 additions & 0 deletions src/routes/groups/joinCommunityUnauthenticatedFlow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { createStackNavigator } from 'react-navigation-stack';

import { navigateNestedReset } from '../../actions/navigation';
import { COMMUNITIES_TAB, MAIN_TABS } from '../../constants';
import { JOIN_GROUP_SCREEN } from '../../containers/Groups/JoinGroupScreen';
import { authFlowGenerator } from '../auth/authFlowGenerator';
import { SIGNUP_TYPES } from '../../containers/Auth/SignUpScreen';

const JoinCommunityUnauthenticatedFlowScreens = authFlowGenerator({
completeAction: navigateNestedReset([
{
routeName: MAIN_TABS,
tabName: COMMUNITIES_TAB,
},
{ routeName: JOIN_GROUP_SCREEN },
]),
includeSignUp: true,
// @ts-ignore
signUpType: SIGNUP_TYPES.JOIN_COMMUNITY,
});

export const JoinCommunityUnauthenticatedFlowNavigator = createStackNavigator(
JoinCommunityUnauthenticatedFlowScreens,
{
defaultNavigationOptions: {
header: null,
},
},
);
Loading