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 account settings/profile #35662

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
67a7d8c
refactor section styling
kosmydel Feb 1, 2024
ce7523d
new Profile page designs
kosmydel Feb 1, 2024
e98f871
Add title styles and spanish translation
filip-solecki Feb 2, 2024
5acf846
Apply styles to both sections
filip-solecki Feb 2, 2024
d5e12f4
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 2, 2024
b8b5976
Fix fontSize and padding
filip-solecki Feb 2, 2024
1160e20
Make title bold
filip-solecki Feb 2, 2024
e679d5d
Fix childrenStyles
filip-solecki Feb 2, 2024
c006060
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 2, 2024
34fe83b
redesign preferences page
kosmydel Feb 2, 2024
9e124d3
Merge branch 'Expensify:main' into update-account-settings/profile
kosmydel Feb 5, 2024
afc7011
Revert "redesign preferences page"
kosmydel Feb 5, 2024
65f460c
Revert unnecessary deleted function
filip-solecki Feb 5, 2024
ad0a03c
Fix Personal Information goBack route
filip-solecki Feb 5, 2024
ce8ecb6
Remove PersonalDetailsPage
filip-solecki Feb 5, 2024
beab06a
Merge branch 'Expensify:main' into update-account-settings/profile
kosmydel Feb 5, 2024
766c54a
Remove personal-details from all profile routes
filip-solecki Feb 5, 2024
366cb8c
Remove personal-details page naming
filip-solecki Feb 6, 2024
e7b1214
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 6, 2024
33608a0
Fix typo
filip-solecki Feb 6, 2024
0329001
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 6, 2024
09fa75d
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 6, 2024
5ee8d9e
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 6, 2024
be9540c
Merge branch 'Expensify:main' into update-account-settings/profile
kosmydel Feb 6, 2024
c0127ee
Merge branch 'Expensify:main' into update-account-settings/profile
kosmydel Feb 6, 2024
7639dad
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 6, 2024
4430320
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 7, 2024
25cd75f
Merge branch 'Expensify:main' into update-account-settings/profile
kosmydel Feb 7, 2024
bc774da
Fix goBack
filip-solecki Feb 7, 2024
99ba948
Update submit navigation
filip-solecki Feb 7, 2024
3f7cd92
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 7, 2024
c576325
Merge branch 'main' into update-account-settings/profile
filip-solecki Feb 8, 2024
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
12 changes: 6 additions & 6 deletions src/components/Section/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import type {StyleProp, TextStyle, ViewStyle} from 'react-native';
import {View} from 'react-native';
import type {ValueOf} from 'type-fest';
import Lottie from '@components/Lottie';
Expand Down Expand Up @@ -42,8 +42,8 @@ type SectionProps = ChildrenProps & {
/** Customize the Section container */
containerStyles?: StyleProp<ViewStyle>;

/** Customize the Section container */
titleStyles?: StyleProp<ViewStyle>;
/** Customize the Section title */
titleStyles?: StyleProp<TextStyle>;

/** Customize the Section container */
subtitleStyles?: StyleProp<ViewStyle>;
Expand Down Expand Up @@ -114,9 +114,9 @@ function Section({
</View>
)}
<View style={[styles.w100, isCentralPane && (isSmallScreenWidth ? styles.p5 : styles.p8)]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, cardLayout === CARD_LAYOUT.ICON_ON_TOP && styles.mh1, titleStyles]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, cardLayout === CARD_LAYOUT.ICON_ON_TOP && styles.mh1]}>
<View style={[styles.flexShrink1]}>
<Text style={[styles.textHeadline, styles.cardSectionTitle]}>{title}</Text>
<Text style={[styles.textHeadline, styles.cardSectionTitle, titleStyles]}>{title}</Text>
</View>
{cardLayout === CARD_LAYOUT.ICON_ON_RIGHT && (
<IconSection
Expand All @@ -127,7 +127,7 @@ function Section({
</View>

{!!subtitle && (
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, cardLayout === CARD_LAYOUT.ICON_ON_TOP ? [styles.mt1, styles.mh1] : styles.mt4, subtitleStyles]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, cardLayout === CARD_LAYOUT.ICON_ON_TOP ? [styles.mt1, styles.mh1] : styles.mt2, subtitleStyles]}>
<Text style={[styles.textNormal, subtitleMuted && styles.colorMuted]}>{subtitle}</Text>
</View>
)}
Expand Down
8 changes: 8 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,14 @@ export default {
offline: 'Offline',
syncing: 'Syncing',
profileAvatar: 'Profile avatar',
publicSection: {
title: 'Public',
subtitle: 'These details are displayed on your public profile, available for people to see.',
},
privateSection: {
title: 'Private',
subtitle: 'These details are used for travel and payments. They are never shown on your public profile.',
},
},
loungeAccessPage: {
loungeAccess: 'Lounge access',
Expand Down
8 changes: 8 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,14 @@ export default {
offline: 'Desconectado',
syncing: 'Sincronizando',
profileAvatar: 'Perfil avatar',
publicSection: {
title: 'Público',
subtitle: 'Estos detalles se muestran en tu perfil público, a disposición de los demás.',
},
privateSection: {
title: 'Privada',
subtitle: 'Estos detalles se utilizan para viajes y pagos. Nunca se mostrarán en tu perfil público.',
},
},
loungeAccessPage: {
loungeAccess: 'Acceso a la sala vip',
Expand Down
160 changes: 115 additions & 45 deletions src/pages/settings/Profile/ProfilePage.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React, {useEffect} from 'react';
import React from 'react';
import {ScrollView, View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItem from '@components/MenuItem';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import ScreenWrapper from '@components/ScreenWrapper';
import Section from '@components/Section';
import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '@components/withCurrentUserPersonalDetails';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import usePrivatePersonalDetails from '@hooks/usePrivatePersonalDetails';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import * as UserUtils from '@libs/UserUtils';
import userPropTypes from '@pages/settings/userPropTypes';
import * as App from '@userActions/App';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand All @@ -36,7 +39,21 @@ const propTypes = {
}),
),

user: userPropTypes,
/** User's private personal details */
privatePersonalDetails: PropTypes.shape({
legalFirstName: PropTypes.string,
legalLastName: PropTypes.string,
dob: PropTypes.string,

/** User's home address */
address: PropTypes.shape({
street: PropTypes.string,
city: PropTypes.string,
state: PropTypes.string,
zip: PropTypes.string,
country: PropTypes.string,
}),
}),

...withLocalizePropTypes,
...windowDimensionsPropTypes,
Expand All @@ -45,12 +62,26 @@ const propTypes = {

const defaultProps = {
loginList: {},
user: {},
...withCurrentUserPersonalDetailsDefaultProps,
privatePersonalDetails: {
legalFirstName: '',
legalLastName: '',
dob: '',
address: {
street: '',
street2: '',
city: '',
state: '',
zip: '',
country: '',
},
},
};

function ProfilePage(props) {
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const getPronouns = () => {
let pronounsKey = lodashGet(props.currentUserPersonalDetails, 'pronouns', '');
if (pronounsKey.startsWith(CONST.PRONOUNS.PREFIX)) {
Expand All @@ -65,8 +96,13 @@ function ProfilePage(props) {
const currentUserDetails = props.currentUserPersonalDetails || {};
const contactMethodBrickRoadIndicator = UserUtils.getLoginListBrickRoadIndicator(props.loginList);
const emojiCode = lodashGet(props, 'currentUserPersonalDetails.status.emojiCode', '');
const {isSmallScreenWidth} = useWindowDimensions();
usePrivatePersonalDetails();
const privateDetails = props.privatePersonalDetails || {};
const legalName = `${privateDetails.legalFirstName || ''} ${privateDetails.legalLastName || ''}`.trim();
const isLoadingPersonalDetails = lodashGet(props.privatePersonalDetails, 'isLoading', true);

const profileSettingsOptions = [
const publicOptions = [
{
description: props.translate('displayNamePage.headerTitle'),
title: lodashGet(currentUserDetails, 'displayName', ''),
Expand All @@ -78,13 +114,11 @@ function ProfilePage(props) {
pageRoute: ROUTES.SETTINGS_CONTACT_METHODS.route,
brickRoadIndicator: contactMethodBrickRoadIndicator,
},
...[
{
description: props.translate('statusPage.status'),
title: emojiCode ? `${emojiCode} ${lodashGet(props, 'currentUserPersonalDetails.status.text', '')}` : '',
pageRoute: ROUTES.SETTINGS_STATUS,
},
],
{
description: props.translate('statusPage.status'),
title: emojiCode ? `${emojiCode} ${lodashGet(props, 'currentUserPersonalDetails.status.text', '')}` : '',
pageRoute: ROUTES.SETTINGS_STATUS,
},
{
description: props.translate('pronounsPage.pronouns'),
title: getPronouns(),
Expand All @@ -97,9 +131,23 @@ function ProfilePage(props) {
},
];

useEffect(() => {
App.openProfile(props.currentUserPersonalDetails);
filip-solecki marked this conversation as resolved.
Show resolved Hide resolved
}, [props.currentUserPersonalDetails]);
const privateOptions = [
{
description: props.translate('privatePersonalDetails.legalName'),
title: legalName,
pageRoute: ROUTES.SETTINGS_PERSONAL_DETAILS_LEGAL_NAME,
},
{
description: props.translate('common.dob'),
title: privateDetails.dob || '',
pageRoute: ROUTES.SETTINGS_PERSONAL_DETAILS_DATE_OF_BIRTH,
},
{
description: props.translate('privatePersonalDetails.address'),
title: PersonalDetailsUtils.getFormattedAddress(props.privatePersonalDetails),
pageRoute: ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS,
},
];

return (
<ScreenWrapper
Expand All @@ -113,34 +161,53 @@ function ProfilePage(props) {
shouldShowBackButton={props.isSmallScreenWidth}
/>
<ScrollView>
<View style={[styles.mt4]}>
{_.map(profileSettingsOptions, (detail, index) => (
<MenuItemWithTopDescription
key={`${detail.title}_${index}`}
shouldShowRightIcon
title={detail.title}
description={detail.description}
onPress={() => Navigation.navigate(detail.pageRoute)}
brickRoadIndicator={detail.brickRoadIndicator}
/>
))}
<View style={[styles.flex1, isSmallScreenWidth ? styles.workspaceSectionMobile : styles.workspaceSection]}>
<Section
title={props.translate('profilePage.publicSection.title')}
subtitle={props.translate('profilePage.publicSection.subtitle')}
isCentralPane
subtitleMuted
childrenStyles={styles.pt3}
titleStyles={styles.accountSettingsSectionTitle}
>
{_.map(publicOptions, (detail, index) => (
<MenuItemWithTopDescription
key={`${detail.title}_${index}`}
shouldShowRightIcon
title={detail.title}
description={detail.description}
wrapperStyle={styles.sectionMenuItemTopDescription}
onPress={() => Navigation.navigate(detail.pageRoute)}
brickRoadIndicator={detail.brickRoadIndicator}
/>
))}
</Section>
<Section
title={props.translate('profilePage.privateSection.title')}
subtitle={props.translate('profilePage.privateSection.subtitle')}
isCentralPane
subtitleMuted
childrenStyles={styles.pt3}
titleStyles={styles.accountSettingsSectionTitle}
>
{isLoadingPersonalDetails ? (
<FullscreenLoadingIndicator style={[styles.flex1, styles.pRelative, StyleUtils.getBackgroundColorStyle(theme.cardBG)]} />
) : (
<>
{_.map(privateOptions, (detail, index) => (
<MenuItemWithTopDescription
key={`${detail.title}_${index}`}
shouldShowRightIcon
title={detail.title}
description={detail.description}
wrapperStyle={styles.sectionMenuItemTopDescription}
filip-solecki marked this conversation as resolved.
Show resolved Hide resolved
onPress={() => Navigation.navigate(detail.pageRoute)}
/>
))}
</>
)}
</Section>
</View>
<MenuItem
title={props.translate('privatePersonalDetails.personalDetails')}
icon={Expensicons.User}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS)}
shouldShowRightIcon
/>
{props.user.hasLoungeAccess && (
<MenuItem
title={props.translate('loungeAccessPage.loungeAccess')}
icon={Expensicons.LoungeAccess}
iconWidth={40}
iconHeight={40}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_LOUNGE_ACCESS)}
shouldShowRightIcon
/>
)}
</ScrollView>
</ScreenWrapper>
);
Expand All @@ -158,6 +225,9 @@ export default compose(
loginList: {
key: ONYXKEYS.LOGIN_LIST,
},
privatePersonalDetails: {
key: ONYXKEYS.PRIVATE_PERSONAL_DETAILS,
},
user: {
key: ONYXKEYS.USER,
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/reimburse/WorkspaceReimburseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function WorkspaceReimburseView(props) {
description={translate('workspace.reimburse.trackDistanceRate')}
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_RATE_AND_UNIT.getRoute(props.policy.id))}
wrapperStyle={[styles.mt3, styles.ph8, styles.mhn8, styles.wAuto]}
wrapperStyle={[styles.sectionMenuItemTopDescription, styles.mt3]}
brickRoadIndicator={(lodashGet(distanceCustomUnit, 'errors') || lodashGet(distanceCustomRate, 'errors')) && CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR}
/>
</OfflineWithFeedback>
Expand Down
13 changes: 12 additions & 1 deletion src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2578,13 +2578,23 @@ const styles = (theme: ThemeColors) =>
color: theme.textSupporting,
},

accountSettingsSectionTitle: {
fontFamily: FontUtils.fontFamily.platform.EXP_NEUE_BOLD,
},

sectionMenuItem: {
borderRadius: 8,
paddingHorizontal: 8,
height: 56,
alignItems: 'center',
},

sectionMenuItemTopDescription: {
...spacing.ph8,
...spacing.mhn8,
width: 'auto',
},

selectCircle: {
width: variables.componentSizeSmall,
height: variables.componentSizeSmall,
Expand Down Expand Up @@ -3359,7 +3369,8 @@ const styles = (theme: ThemeColors) =>
},

cardSectionTitle: {
lineHeight: variables.lineHeightXXLarge,
fontSize: variables.fontSizeLarge,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that these style changes are already approved by design?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is taken from Figma

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok just wanna make sure that this is intentional by design.

this branch:
Screenshot 2024-02-05 at 6 45 55 PM

staging:
Screenshot 2024-02-05 at 6 46 00 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design link - I think it is ok

lineHeight: variables.lineHeightXLarge,
},

cardMenuItem: {
Expand Down
2 changes: 1 addition & 1 deletion src/styles/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export default {
bankCardHeight: 26,
workspaceTypeIconWidth: 34,
sectionMargin: 16,
workspaceSectionMaxWidth: 600,
workspaceSectionMaxWidth: 680,
sectionIllustrationHeight: 240,
photoUploadPopoverWidth: 335,

Expand Down
Loading