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

[ideal-nav] Full-screen account settings #32960

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
68a40f8
add test navigator
kosmydel Nov 21, 2023
bddaa69
draft
kosmydel Nov 21, 2023
d8910f7
add patch
kosmydel Nov 21, 2023
52388b9
draft
kosmydel Nov 21, 2023
0d665ef
another step
kosmydel Nov 21, 2023
dba92bf
another step forward
kosmydel Nov 21, 2023
14e0741
another step forward
kosmydel Nov 21, 2023
18ed44a
another step forward 123
kosmydel Nov 21, 2023
7fa40ae
mini step forward
kosmydel Nov 21, 2023
f53a6d0
add initial state
kosmydel Nov 21, 2023
6b1dee1
few fixes
kosmydel Nov 21, 2023
8703e12
fix closing settings
kosmydel Nov 23, 2023
248d664
revert
kosmydel Nov 23, 2023
a5ce5bf
fix deeplink
kosmydel Nov 23, 2023
a303913
add better linking
kosmydel Nov 23, 2023
f24f917
general refactor
kosmydel Nov 23, 2023
4072ba1
fix back button
kosmydel Nov 23, 2023
2125299
add custom stack navigator factory
kosmydel Nov 23, 2023
a77cbde
split CustomRouter into two
kosmydel Nov 23, 2023
9027337
cleanup
kosmydel Nov 23, 2023
5101667
restore settings subpage from deeplink
kosmydel Nov 23, 2023
a5e2c76
cleanup
kosmydel Nov 24, 2023
a6e6f77
add mobile navigator
kosmydel Nov 24, 2023
65a1871
rename navigator
kosmydel Nov 27, 2023
a1de980
add escape support
kosmydel Nov 27, 2023
1f3337b
cleanup
kosmydel Nov 27, 2023
eed29ca
cleanup
kosmydel Nov 27, 2023
5c4f8b8
Merge branch 'main' into @kosmydel/ideal-nav
kosmydel Nov 29, 2023
d7777fa
Setup translations
mateuuszzzzz Dec 6, 2023
07b296a
Redesign InitialSettingsPage
mateuuszzzzz Dec 6, 2023
cd2bf3a
Adjust styles and StyleUtils to the new menu color palette
mateuuszzzzz Dec 6, 2023
0648bf2
Run prettier
mateuuszzzzz Dec 6, 2023
71f5f82
Merge branch 'main' into wave8/account-settings-style
mateuuszzzzz Dec 6, 2023
5a13517
Modify translations
mateuuszzzzz Dec 6, 2023
291f92b
Modify translations
mateuuszzzzz Dec 6, 2023
1701c86
Modify spanish translations
mateuuszzzzz Dec 7, 2023
c4d2116
Merge branch 'main' into @kosmydel/ideal-nav
kosmydel Dec 7, 2023
bc14361
Revert "Merge branch 'main' into wave8/account-settings-style"
mateuuszzzzz Dec 7, 2023
7d07b9d
fix issues
kosmydel Dec 7, 2023
1d250af
Revert "Revert "Merge branch 'main' into wave8/account-settings-style""
mateuuszzzzz Dec 7, 2023
da3441d
migrate custom full screen router
kosmydel Dec 7, 2023
6c32902
migrate FullScreenNavigator to TS
kosmydel Dec 7, 2023
f25b702
fix typing
kosmydel Dec 7, 2023
a098a69
Refactor styles
mateuuszzzzz Dec 7, 2023
623e419
another fix
kosmydel Dec 7, 2023
8458597
Refactor comments
mateuuszzzzz Dec 7, 2023
25a909b
another typescript step
kosmydel Dec 7, 2023
117b717
split createCustomStackNavigator
kosmydel Dec 7, 2023
84eb21f
full screen animations
kosmydel Dec 7, 2023
7d3b17e
Merge remote-tracking branch 'origin-swm/wave8/account-settings-style…
kosmydel Dec 7, 2023
0c50ea6
add current route displaying
kosmydel Dec 7, 2023
205b696
temp: fix qr codes
kosmydel Dec 7, 2023
e908c93
fix going back in the settings
kosmydel Dec 8, 2023
df5da55
make the animations responsive
kosmydel Dec 8, 2023
f5e5090
better animations handling
kosmydel Dec 8, 2023
f9b22fc
Merge branch 'main' into wave8/account-settings-style
mateuuszzzzz Dec 11, 2023
295d1cc
refactor
kosmydel Dec 11, 2023
315d28e
Adjust designs
mateuuszzzzz Dec 13, 2023
5527eca
Resolve conflicts
mateuuszzzzz Dec 13, 2023
c36f08e
Remove unused imports
mateuuszzzzz Dec 13, 2023
f73047e
Remove unused onyx keys
mateuuszzzzz Dec 13, 2023
1e162ea
move avatar picker
kosmydel Dec 13, 2023
f2ddfa2
add bottom borders
kosmydel Dec 13, 2023
37bd07d
Merge remote-tracking branch 'origin-swm/wave8/account-settings-style…
kosmydel Dec 13, 2023
0092556
complete merge with main
kosmydel Dec 13, 2023
307e668
fix issues
kosmydel Dec 13, 2023
fcd5f61
fix padding
kosmydel Dec 15, 2023
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 @@ -43,7 +43,7 @@ index 7558eb3..b7bb75e 100644
}) : STATE_TRANSITIONING_OR_BELOW_TOP;
}
+
+ const isHomeScreenAndNotOnTop = route.name === 'Home' && isScreenActive !== STATE_ON_TOP;
+ const isHomeScreenAndNotOnTop = (route.name === 'Home' || route.name === 'SettingsHome') && isScreenActive !== STATE_ON_TOP;
+
const {
headerShown = true,
Expand Down
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ const CONST = {
3: 100,
},
},
CENTRAL_PANE_ANIMATION_HEIGHT: 200,
LHN_SKELETON_VIEW_ITEM_HEIGHT: 64,
EXPENSIFY_PARTNER_NAME: 'expensify.com',
EMAIL: {
Expand Down
2 changes: 2 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const ROUTES = {
},

SETTINGS: 'settings',
SETTINGS_HOME: 'settings_new',
SETTINGS_NEW_PROFILE: 'settings_new/profile',
SETTINGS_PROFILE: 'settings/profile',
SETTINGS_SHARE_CODE: 'settings/shareCode',
SETTINGS_DISPLAY_NAME: 'settings/profile/display-name',
Expand Down
2 changes: 2 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const SCREENS = {
TRANSITION_BETWEEN_APPS: 'TransitionBetweenApps',
VALIDATE_LOGIN: 'ValidateLogin',
UNLINK_LOGIN: 'UnlinkLogin',
SETTINGS_HOME: 'SettingsHome',
SETTINGS_CENTRAL_PANE: 'SettingsCentralPane',
SETTINGS: {
ROOT: 'Settings_Root',
SHARE_CODE: 'Settings_Share_Code',
Expand Down
10 changes: 7 additions & 3 deletions src/components/AvatarWithImagePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ const propTypes = {
horizontal: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL)),
vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)),
}),

/** Style applied to the avatar */
avatarStyle: stylePropTypes.isRequired,
};

const defaultProps = {
Expand Down Expand Up @@ -141,6 +144,7 @@ function AvatarWithImagePicker({
anchorAlignment,
onImageSelected,
editorMaskImage,
avatarStyle,
}) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -287,7 +291,7 @@ function AvatarWithImagePicker({

return (
<View style={StyleSheet.flatten([styles.alignItemsCenter, style])}>
<View style={[styles.pRelative, styles.avatarLarge]}>
<View style={[styles.pRelative, avatarStyle]}>
<OfflineWithFeedback
pendingAction={pendingAction}
errors={errors}
Expand All @@ -305,8 +309,8 @@ function AvatarWithImagePicker({
<View>
{source ? (
<Avatar
containerStyles={styles.avatarLarge}
imageStyles={[styles.avatarLarge, styles.alignSelfCenter]}
containerStyles={avatarStyle}
imageStyles={[avatarStyle, styles.alignSelfCenter]}
source={source}
fallbackIcon={fallbackIcon}
size={size}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ const propTypes = {

/** Whether we should navigate to report page when the route have a topMostReport */
shouldNavigateToTopMostReport: PropTypes.bool,

/** Whether we should show the back button only on mobile */
shouldUseCentralPaneView: PropTypes.bool,
};

export default propTypes;
18 changes: 16 additions & 2 deletions src/components/HeaderWithBackButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import useKeyboardState from '@hooks/useKeyboardState';
import useLocalize from '@hooks/useLocalize';
import useThrottledButtonState from '@hooks/useThrottledButtonState';
import useWaitForNavigation from '@hooks/useWaitForNavigation';
import useWindowDimensions from '@hooks/useWindowDimensions';
import getButtonState from '@libs/getButtonState';
import Navigation from '@libs/Navigation/Navigation';
import useStyleUtils from '@styles/useStyleUtils';
Expand Down Expand Up @@ -40,6 +41,7 @@ function HeaderWithBackButton({
shouldShowPinButton = false,
shouldShowThreeDotsButton = false,
shouldDisableThreeDotsButton = false,
shouldUseCentralPaneView = false,
stepCounter = null,
subtitle = '',
title = '',
Expand All @@ -61,15 +63,27 @@ function HeaderWithBackButton({
const {translate} = useLocalize();
const {isKeyboardShown} = useKeyboardState();
const waitForNavigate = useWaitForNavigation();
const {isSmallScreenWidth} = useWindowDimensions();
const shouldFinalShowBackButton = shouldShowBackButton && (!shouldUseCentralPaneView || isSmallScreenWidth);
return (
<View
// Hover on some part of close icons will not work on Electron if dragArea is true
// https://github.com/Expensify/App/issues/29598
dataSet={{dragArea: false}}
style={[styles.headerBar, shouldShowBorderBottom && styles.borderBottom, shouldShowBackButton && styles.pl2]}
>
<View style={[styles.dFlex, styles.flexRow, styles.alignItemsCenter, styles.flexGrow1, styles.justifyContentBetween, styles.overflowHidden]}>
{shouldShowBackButton && (
<View
style={[
styles.dFlex,
styles.flexRow,
styles.alignItemsCenter,
styles.flexGrow1,
styles.justifyContentBetween,
styles.overflowHidden,
!shouldFinalShowBackButton && styles.pl5,
]}
>
{shouldFinalShowBackButton && (
<Tooltip text={translate('common.back')}>
<PressableWithoutFeedback
onPress={() => {
Expand Down
10 changes: 8 additions & 2 deletions src/components/IllustratedHeaderPageLayout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import useWindowDimensions from '@hooks/useWindowDimensions';
import useTheme from '@styles/themes/useTheme';
import useThemeStyles from '@styles/useThemeStyles';
import HeaderPageLayout from './HeaderPageLayout';
Expand Down Expand Up @@ -34,6 +35,10 @@ const defaultProps = {
function IllustratedHeaderPageLayout({backgroundColor, children, illustration, footer, overlayContent, ...propsToPassToHeader}) {
const theme = useTheme();
const styles = useThemeStyles();
const {isSmallScreenWidth} = useWindowDimensions();

const shouldUseMaxHeight = propsToPassToHeader.shouldUseCentralPaneView && !isSmallScreenWidth;

return (
<HeaderPageLayout
backgroundColor={backgroundColor || theme.appBG}
Expand All @@ -43,14 +48,15 @@ function IllustratedHeaderPageLayout({backgroundColor, children, illustration, f
<Lottie
source={illustration}
style={styles.w100}
webStyle={styles.w100}
webStyle={shouldUseMaxHeight ? styles.h100 : styles.w100}
autoPlay
loop
/>
{overlayContent && overlayContent()}
</>
}
headerContainerStyles={[styles.justifyContentCenter, styles.w100]}
// TODO: move to variables
headerContainerStyles={[styles.justifyContentCenter, styles.w100, shouldUseMaxHeight && styles.centralPaneAnimation]}
footer={footer}
// eslint-disable-next-line react/jsx-props-no-spreading
{...propsToPassToHeader}
Expand Down
9 changes: 8 additions & 1 deletion src/components/QRShare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import _ from 'underscore';
import ExpensifyWordmark from '@assets/images/expensify-wordmark.svg';
import QRCode from '@components/QRCode';
import Text from '@components/Text';
import useWindowDimensions from '@hooks/useWindowDimensions';
import useTheme from '@styles/themes/useTheme';
import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import {qrShareDefaultProps, qrSharePropTypes} from './propTypes';

function QRShare({innerRef, url, title, subtitle, logo, logoRatio, logoMarginRatio}) {
const styles = useThemeStyles();
const theme = useTheme();
const {isSmallScreenWidth} = useWindowDimensions();

const [qrCodeSize, setQrCodeSize] = useState(1);
const svgRef = useRef(null);
Expand All @@ -26,7 +29,11 @@ function QRShare({innerRef, url, title, subtitle, logo, logoRatio, logoMarginRat

const onLayout = (event) => {
const containerWidth = event.nativeEvent.layout.width - variables.qrShareHorizontalPadding * 2 || 0;
setQrCodeSize(Math.max(1, containerWidth));
if (isSmallScreenWidth) {
setQrCodeSize(Math.max(1, containerWidth));
return;
}
setQrCodeSize(Math.max(1, Math.min(containerWidth, CONST.CENTRAL_PANE_ANIMATION_HEIGHT)));
};

return (
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,9 @@ export default {
phrase4: 'Privacy',
},
help: 'Help',
accountSettings: 'Account Settings',
account: 'Account',
general: 'General',
},
closeAccountPage: {
closeAccount: 'Close account',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ export default {
phrase4: 'Privacidad',
},
help: 'Ayuda',
accountSettings: 'Configuración de la cuenta',
account: 'Cuenta',
general: 'General',
},
closeAccountPage: {
closeAccount: 'Cerrar cuenta',
Expand Down
8 changes: 7 additions & 1 deletion src/libs/Navigation/AppNavigator/AuthScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import useWindowDimensions from '@hooks/useWindowDimensions';
import KeyboardShortcut from '@libs/KeyboardShortcut';
import getCurrentUrl from '@libs/Navigation/currentUrl';
import Navigation from '@libs/Navigation/Navigation';
import {AuthScreensParamList} from '@libs/Navigation/types';
import NetworkConnection from '@libs/NetworkConnection';
import * as Pusher from '@libs/Pusher/pusher';
import PusherConnectionManager from '@libs/PusherConnectionManager';
import * as SessionUtils from '@libs/SessionUtils';
import type {AuthScreensParamList} from '@navigation/types';
import DemoSetupPage from '@pages/DemoSetupPage';
import NotFoundPage from '@pages/ErrorPage/NotFoundPage';
import DesktopSignInRedirectPage from '@pages/signin/DesktopSignInRedirectPage';
Expand All @@ -36,6 +36,7 @@ import createCustomStackNavigator from './createCustomStackNavigator';
import defaultScreenOptions from './defaultScreenOptions';
import getRootNavigatorScreenOptions from './getRootNavigatorScreenOptions';
import CentralPaneNavigator from './Navigators/CentralPaneNavigator';
import FullScreenNavigator from './Navigators/FullScreenNavigator';
import RightModalNavigator from './Navigators/RightModalNavigator';

type AuthScreensProps = {
Expand Down Expand Up @@ -318,6 +319,11 @@ function AuthScreens({lastUpdateIDAppliedToClient, session, lastOpenedPublicRoom
component={RightModalNavigator}
listeners={modalScreenListeners}
/>
<RootStack.Screen
name={NAVIGATORS.FULL_SCREEN_NAVIGATOR}
options={screenOptions.fullScreen}
component={FullScreenNavigator}
/>
<RootStack.Screen
name={SCREENS.DESKTOP_SIGN_IN_REDIRECT}
options={screenOptions.fullScreen}
Expand Down
20 changes: 18 additions & 2 deletions src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import type {
TeachersUniteNavigatorParamList,
WalletStatementNavigatorParamList,
} from '@navigation/types';
import {ThemeStyles} from '@styles/styles';
import useThemeStyles from '@styles/useThemeStyles';
import SCREENS from '@src/SCREENS';
import type {Screen} from '@src/SCREENS';
Expand All @@ -39,7 +40,7 @@ type Screens = Partial<Record<Screen, () => React.ComponentType>>;
*
* @param screens key/value pairs where the key is the name of the screen and the value is a functon that returns the lazy-loaded component
*/
function createModalStackNavigator<TStackParams extends ParamListBase>(screens: Screens): React.ComponentType {
function createModalStackNavigator<TStackParams extends ParamListBase>(screens: Screens, getScreenOptions?: (styles: ThemeStyles) => StackNavigationOptions): React.ComponentType {
const ModalStackNavigator = createStackNavigator<TStackParams>();

function ModalStack() {
Expand All @@ -55,7 +56,7 @@ function createModalStackNavigator<TStackParams extends ParamListBase>(screens:
);

return (
<ModalStackNavigator.Navigator screenOptions={defaultSubRouteOptions}>
<ModalStackNavigator.Navigator screenOptions={getScreenOptions?.(styles) ?? defaultSubRouteOptions}>
{Object.keys(screens as Required<Screens>).map((name) => (
<ModalStackNavigator.Screen
key={name}
Expand Down Expand Up @@ -177,6 +178,20 @@ const NewTeachersUniteNavigator = createModalStackNavigator<TeachersUniteNavigat
[SCREENS.I_AM_A_TEACHER]: () => require('../../../pages/TeachersUnite/ImTeacherPage').default as React.ComponentType,
});

// should it be merged with SettingsModalStackNavigator?
const AccountSettingsModalStackNavigator = createModalStackNavigator(
{
[SCREENS.SETTINGS.WORKSPACES]: () => require('../../../pages/workspace/WorkspacesListPage').default as React.ComponentType,
[SCREENS.SETTINGS.PREFERENCES.ROOT]: () => require('../../../pages/settings/Preferences/PreferencesPage').default as React.ComponentType,
[SCREENS.SETTINGS.SECURITY]: () => require('../../../pages/settings/Security/SecuritySettingsPage').default as React.ComponentType,
[SCREENS.SETTINGS.PROFILE.ROOT]: () => require('../../../pages/settings/Profile/ProfilePage').default as React.ComponentType,
[SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../pages/ShareCodePage').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,
},
(styles) => ({cardStyle: styles.navigationScreenCardStyle, headerShown: false}),
);

const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorParamList>({
[SCREENS.SETTINGS.ROOT]: () => require('../../../pages/settings/InitialSettingsPage').default as React.ComponentType,
[SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../pages/ShareCodePage').default as React.ComponentType,
Expand Down Expand Up @@ -291,6 +306,7 @@ export {
SearchModalStackNavigator,
NewChatModalStackNavigator,
NewTaskModalStackNavigator,
AccountSettingsModalStackNavigator,
SettingsModalStackNavigator,
EnablePaymentsStackNavigator,
AddPersonalBankAccountModalStackNavigator,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import {View} from 'react-native';
import useWindowDimensions from '@hooks/useWindowDimensions';
import createCustomFullScreenNavigator from '@libs/Navigation/AppNavigator/createCustomFullScreenNavigator';
import getRootNavigatorScreenOptions from '@libs/Navigation/AppNavigator/getRootNavigatorScreenOptions';
import * as ModalStackNavigators from '@libs/Navigation/AppNavigator/ModalStackNavigators';
import useThemeStyles from '@styles/useThemeStyles';
import SCREENS from '@src/SCREENS';

const loadPage = () => require('../../../../pages/settings/InitialSettingsPage').default as React.ComponentType;

const RootStack = createCustomFullScreenNavigator();

function FullScreenNavigator() {
const styles = useThemeStyles();
const {isSmallScreenWidth} = useWindowDimensions();
const screenOptions = getRootNavigatorScreenOptions(isSmallScreenWidth, styles);

return (
<View style={styles.rootNavigatorContainerStyles(isSmallScreenWidth)}>
<RootStack.Navigator isSmallScreenWidth={isSmallScreenWidth}>
<RootStack.Screen
name={SCREENS.SETTINGS_HOME}
options={screenOptions.homeScreen}
getComponent={loadPage}
/>
<RootStack.Screen
name={SCREENS.SETTINGS_CENTRAL_PANE}
options={screenOptions.centralPaneNavigator}
component={ModalStackNavigators.AccountSettingsModalStackNavigator}
/>
</RootStack.Navigator>
</View>
);
}

FullScreenNavigator.displayName = 'FullScreenNavigator';

export default FullScreenNavigator;
Loading
Loading