Skip to content

Commit

Permalink
Merge pull request Expensify#37175 from Amarparab2024/issue36649
Browse files Browse the repository at this point in the history
Remove `Save the World` from Global Create, and move it into Settings
  • Loading branch information
marcochavezf authored Apr 9, 2024
2 parents 0f4c845 + 11fc00a commit 76c7fa9
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 40 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ const ROUTES = {
getRoute: (backTo?: string) => getUrlWithBackToParam('settings/exit-survey/confirm', backTo),
},

SETTINGS_SAVE_THE_WORLD: 'settings/teachersunite',

KEYBOARD_SHORTCUTS: 'keyboard-shortcuts',

NEW: 'new',
Expand Down Expand Up @@ -439,10 +441,10 @@ const ROUTES = {
ONBOARD_MANAGE_EXPENSES: 'onboard/manage-expenses',
ONBOARD_EXPENSIFY_CLASSIC: 'onboard/expensify-classic',

TEACHERS_UNITE: 'teachersunite',
I_KNOW_A_TEACHER: 'teachersunite/i-know-a-teacher',
I_AM_A_TEACHER: 'teachersunite/i-am-a-teacher',
INTRO_SCHOOL_PRINCIPAL: 'teachersunite/intro-school-principal',
TEACHERS_UNITE: 'settings/teachersunite',
I_KNOW_A_TEACHER: 'settings/teachersunite/i-know-a-teacher',
I_AM_A_TEACHER: 'settings/teachersunite/i-am-a-teacher',
INTRO_SCHOOL_PRINCIPAL: 'settings/teachersunite/intro-school-principal',

ERECEIPT: {
route: 'eReceipt/:transactionID',
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const SCREENS = {
WORKSPACES: 'Settings_Workspaces',
SECURITY: 'Settings_Security',
ABOUT: 'Settings_About',
SAVE_THE_WORLD: 'Settings_TeachersUnite',
APP_DOWNLOAD_LINKS: 'Settings_App_Download_Links',
ADD_DEBIT_CARD: 'Settings_Add_Debit_Card',
ADD_BANK_ACCOUNT: 'Settings_Add_Bank_Account',
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Illustrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import ShieldYellow from '@assets/images/simple-illustrations/simple-illustratio
import SmallRocket from '@assets/images/simple-illustrations/simple-illustration__smallrocket.svg';
import SplitBill from '@assets/images/simple-illustrations/simple-illustration__splitbill.svg';
import Tag from '@assets/images/simple-illustrations/simple-illustration__tag.svg';
import TeachersUnite from '@assets/images/simple-illustrations/simple-illustration__teachers-unite.svg';
import ThumbsUpStars from '@assets/images/simple-illustrations/simple-illustration__thumbsupstars.svg';
import TrackShoe from '@assets/images/simple-illustrations/simple-illustration__track-shoe.svg';
import TrashCan from '@assets/images/simple-illustrations/simple-illustration__trashcan.svg';
Expand Down Expand Up @@ -158,6 +159,7 @@ export {
Workflows,
ThreeLeggedLaptopWoman,
House,
TeachersUnite,
Abacus,
Binoculars,
CompanyCard,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.TAX_NAME]: () => require('../../../../pages/workspace/taxes/NamePage').default as React.ComponentType,
[SCREENS.WORKSPACE.TAX_VALUE]: () => require('../../../../pages/workspace/taxes/ValuePage').default as React.ComponentType,
[SCREENS.WORKSPACE.TAX_CREATE]: () => require('../../../../pages/workspace/taxes/WorkspaceCreateTaxPage').default as React.ComponentType,
[SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default as React.ComponentType,
});

const EnablePaymentsStackNavigator = createModalStackNavigator<EnablePaymentsNavigatorParamList>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const settingsScreens = {
[SCREENS.SETTINGS.PROFILE.ROOT]: () => require('../../../../../pages/settings/Profile/ProfilePage').default as React.ComponentType,
[SCREENS.SETTINGS.WALLET.ROOT]: () => require('../../../../../pages/settings/Wallet/WalletPage').default as React.ComponentType,
[SCREENS.SETTINGS.ABOUT]: () => require('../../../../../pages/settings/AboutPage/AboutPage').default as React.ComponentType,
[SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../../pages/TeachersUnite/SaveTheWorldPage').default as React.ComponentType,
} satisfies Screens;

function BaseCentralPaneNavigator() {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
exact: true,
},
[SCREENS.SETTINGS.WORKSPACES]: ROUTES.SETTINGS_WORKSPACES,
[SCREENS.SETTINGS.SAVE_THE_WORLD]: ROUTES.SETTINGS_SAVE_THE_WORLD,
},
},
[SCREENS.NOT_FOUND]: '*',
Expand Down Expand Up @@ -484,7 +485,6 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
},
[SCREENS.RIGHT_MODAL.TEACHERS_UNITE]: {
screens: {
[SCREENS.SAVE_THE_WORLD.ROOT]: ROUTES.TEACHERS_UNITE,
[SCREENS.I_KNOW_A_TEACHER]: ROUTES.I_KNOW_A_TEACHER,
[SCREENS.INTRO_SCHOOL_PRINCIPAL]: ROUTES.INTRO_SCHOOL_PRINCIPAL,
[SCREENS.I_AM_A_TEACHER]: ROUTES.I_AM_A_TEACHER,
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type CentralPaneNavigatorParamList = {
[SCREENS.SETTINGS.WALLET.ROOT]: undefined;
[SCREENS.SETTINGS.ABOUT]: undefined;
[SCREENS.SETTINGS.WORKSPACES]: undefined;
[SCREENS.SETTINGS.SAVE_THE_WORLD]: undefined;
};

type WorkspaceSwitcherNavigatorParamList = {
Expand Down
94 changes: 66 additions & 28 deletions src/pages/TeachersUnite/SaveTheWorldPage.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,87 @@
import React from 'react';
import React, {useMemo} from 'react';
import {View} from 'react-native';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Illustrations from '@components/Icon/Illustrations';
import LottieAnimations from '@components/LottieAnimations';
import MenuItem from '@components/MenuItem';
import Text from '@components/Text';
import MenuItemList from '@components/MenuItemList';
import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
import Section from '@components/Section';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWaitForNavigation from '@hooks/useWaitForNavigation';
import useWindowDimensions from '@hooks/useWindowDimensions';
import Navigation from '@libs/Navigation/Navigation';
import type {TranslationPaths} from '@src/languages/types';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';

function SaveTheWorldPage() {
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
const waitForNavigate = useWaitForNavigation();
const {isSmallScreenWidth} = useWindowDimensions();
const theme = useTheme();

const menuItems = useMemo(() => {
const baseMenuItems = [
{
translationKey: 'teachersUnitePage.iKnowATeacher',
action: waitForNavigate(() => Navigation.navigate(ROUTES.I_KNOW_A_TEACHER)),
},
{
translationKey: 'teachersUnitePage.iAmATeacher',
action: waitForNavigate(() => Navigation.navigate(ROUTES.I_AM_A_TEACHER)),
},
];

return baseMenuItems.map((item) => ({
key: item.translationKey,
title: translate(item.translationKey as TranslationPaths),
onPress: item.action,
shouldShowRightIcon: true,
link: '',
wrapperStyle: [styles.sectionMenuItemTopDescription],
}));
}, [translate, waitForNavigate, styles]);

return (
<IllustratedHeaderPageLayout
shouldShowBackButton
title={translate('sidebarScreen.saveTheWorld')}
backgroundColor={theme.PAGE_THEMES[SCREENS.SAVE_THE_WORLD.ROOT].backgroundColor}
onBackButtonPress={Navigation.goBack}
illustration={LottieAnimations.SaveTheWorld}
<ScreenWrapper
testID={SaveTheWorldPage.displayName}
includeSafeAreaPaddingBottom={false}
shouldEnablePickerAvoiding={false}
shouldShowOfflineIndicatorInWideScreen
>
<View style={[styles.mb4, styles.justifyContentBetween, styles.mh5]}>
<Text style={[styles.textHeadline, styles.mb3]}>{translate('teachersUnitePage.teachersUnite')}</Text>
<Text>{translate('teachersUnitePage.joinExpensifyOrg')}</Text>
</View>

<MenuItem
shouldShowRightIcon
title={translate('teachersUnitePage.iKnowATeacher')}
onPress={() => Navigation.navigate(ROUTES.I_KNOW_A_TEACHER)}
/>

<MenuItem
shouldShowRightIcon
title={translate('teachersUnitePage.iAmATeacher')}
onPress={() => Navigation.navigate(ROUTES.I_AM_A_TEACHER)}
<HeaderWithBackButton
title={translate('sidebarScreen.saveTheWorld')}
shouldShowBackButton={isSmallScreenWidth}
onBackButtonPress={() => Navigation.goBack()}
icon={Illustrations.TeachersUnite}
/>
</IllustratedHeaderPageLayout>
<ScrollView contentContainerStyle={styles.pt3}>
<View style={[styles.flex1, isSmallScreenWidth ? styles.workspaceSectionMobile : styles.workspaceSection]}>
<Section
title={translate('teachersUnitePage.teachersUnite')}
subtitle={translate('teachersUnitePage.joinExpensifyOrg')}
isCentralPane
subtitleMuted
illustration={LottieAnimations.SaveTheWorld}
illustrationBackgroundColor={theme.PAGE_THEMES[SCREENS.SAVE_THE_WORLD.ROOT].backgroundColor}
titleStyles={styles.accountSettingsSectionTitle}
childrenStyles={styles.pt5}
>
<MenuItemList
menuItems={menuItems}
shouldUseSingleExecution
/>
</Section>
</View>
</ScrollView>
</ScreenWrapper>
);
}

SaveTheWorldPage.displayName = 'SaveTheWorldPage';
SaveTheWorldPage.displayName = 'SettingSecurityPage';

export default SaveTheWorldPage;
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import usePrevious from '@hooks/usePrevious';
import useThemeStyles from '@hooks/useThemeStyles';
import compose from '@libs/compose';
import interceptAnonymousUser from '@libs/interceptAnonymousUser';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import personalDetailsPropType from '@pages/personalDetailsPropType';
import * as App from '@userActions/App';
Expand All @@ -25,7 +24,6 @@ import * as Report from '@userActions/Report';
import * as Task from '@userActions/Task';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';

/**
* @param {Object} [policy]
Expand Down Expand Up @@ -334,11 +332,6 @@ function FloatingActionButtonAndPopover(props) {
text: translate('newTaskPage.assignTask'),
onSelected: () => interceptAnonymousUser(() => Task.clearOutTaskInfoAndNavigate()),
},
{
icon: Expensicons.Heart,
text: translate('sidebarScreen.saveTheWorld'),
onSelected: () => interceptAnonymousUser(() => Navigation.navigate(ROUTES.TEACHERS_UNITE)),
},
...(!props.isLoading && !Policy.hasActiveChatEnabledPolicies(props.allPolicies)
? [
{
Expand Down
5 changes: 5 additions & 0 deletions src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ function InitialSettingsPage({session, userWallet, bankAccountList, fundList, wa
icon: Expensicons.Info,
routeName: ROUTES.SETTINGS_ABOUT,
},
{
translationKey: 'sidebarScreen.saveTheWorld',
icon: Expensicons.Heart,
routeName: ROUTES.SETTINGS_SAVE_THE_WORLD,
},
{
translationKey: signOutTranslationKey,
icon: Expensicons.Exit,
Expand Down

0 comments on commit 76c7fa9

Please sign in to comment.