-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Release 2] [Domain control] Add DomainMemberDetialsPage RHP
#79358
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
Merged
mountiny
merged 17 commits into
Expensify:main
from
software-mansion-labs:feature/kuba-nowakowski/add_domain_members_details_page
Jan 13, 2026
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
eb9cc4c
add members details page
sumo-slonik 97a9868
Merge branch 'refs/heads/feature/kuba-nowakowski/add__domain_members_…
war-in f41f400
refactor: remove outdated & unnecessary code
war-in 59968bc
Merge branch 'feature/kuba-nowakowski/add__domain_members_page' into …
war-in 3d6289a
chore: remove polish descriptions
war-in f82b58e
Merge branch 'feature/kuba-nowakowski/add__domain_members_page' into …
war-in f0eb892
refactor: apply review comments
war-in d8b5e1c
Merge branch 'refs/heads/feature/kuba-nowakowski/add__domain_members_…
war-in 168f0a1
Merge branch 'refs/heads/feature/kuba-nowakowski/add__domain_members_…
war-in 7a5cced
fix: post-merge fixes
war-in 2513796
Merge branch 'refs/heads/main' into feature/kuba-nowakowski/add_domai…
war-in ed0d8bb
fix: prettier & eslint
war-in af4b7d1
fix: remove unused type
war-in 59dde9b
chore: add comment
war-in 87d46cc
Merge branch 'refs/heads/main' into feature/kuba-nowakowski/add_domai…
war-in 951678c
fix: eslint
war-in 7dd21ae
fix: correct layout wrapping
war-in File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| import {Str} from 'expensify-common'; | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
| import Avatar from '@components/Avatar'; | ||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import MenuItem from '@components/MenuItem'; | ||
| import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; | ||
| import OfflineWithFeedback from '@components/OfflineWithFeedback'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import ScrollView from '@components/ScrollView'; | ||
| import Text from '@components/Text'; | ||
| import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useOnyx from '@hooks/useOnyx'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import {getDisplayNameOrDefault, getPhoneNumber} from '@libs/PersonalDetailsUtils'; | ||
| import Navigation from '@navigation/Navigation'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import ROUTES from '@src/ROUTES'; | ||
| import type {PersonalDetailsList} from '@src/types/onyx'; | ||
| import DomainNotFoundPageWrapper from './DomainNotFoundPageWrapper'; | ||
|
|
||
| type BaseDomainMemberDetailsComponentProps = { | ||
| /** Domain ID */ | ||
| domainAccountID: number; | ||
|
|
||
| /** User account ID */ | ||
| accountID: number; | ||
|
|
||
| /** List of additional fields (e.g., force 2FA) */ | ||
| children?: React.ReactNode; | ||
| }; | ||
|
|
||
| function BaseDomainMemberDetailsComponent({domainAccountID, accountID, children}: BaseDomainMemberDetailsComponentProps) { | ||
| const styles = useThemeStyles(); | ||
| const {translate, formatPhoneNumber} = useLocalize(); | ||
| const icons = useMemoizedLazyExpensifyIcons(['Info']); | ||
|
|
||
| // The selector depends on the dynamic `accountID`, so it cannot be extracted | ||
| // to a static function outside the component. | ||
| // eslint-disable-next-line rulesdir/no-inline-useOnyx-selector | ||
| const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, { | ||
| canBeMissing: true, | ||
| selector: (personalDetailsList: OnyxEntry<PersonalDetailsList>) => personalDetailsList?.[accountID], | ||
| }); | ||
|
|
||
| const displayName = formatPhoneNumber(getDisplayNameOrDefault(personalDetails)); | ||
| const phoneNumber = getPhoneNumber(personalDetails); | ||
| const memberLogin = personalDetails?.login ?? ''; | ||
| const isSMSLogin = Str.isSMSLogin(memberLogin); | ||
| const copyableName = isSMSLogin ? formatPhoneNumber(phoneNumber ?? '') : memberLogin; | ||
|
|
||
| return ( | ||
| <DomainNotFoundPageWrapper domainAccountID={domainAccountID}> | ||
| <ScreenWrapper | ||
| enableEdgeToEdgeBottomSafeAreaPadding | ||
| testID={BaseDomainMemberDetailsComponent.displayName} | ||
| > | ||
| <HeaderWithBackButton title={displayName} /> | ||
|
|
||
| <ScrollView addBottomSafeAreaPadding> | ||
| <View style={[styles.containerWithSpaceBetween, styles.pointerEventsBoxNone, styles.justifyContentStart]}> | ||
| <View style={[styles.avatarSectionWrapper, styles.pb0]}> | ||
| <OfflineWithFeedback pendingAction={personalDetails?.pendingFields?.avatar}> | ||
| <Avatar | ||
| containerStyles={[styles.avatarXLarge, styles.mb4, styles.noOutline]} | ||
| imageStyles={[styles.avatarXLarge]} | ||
| source={personalDetails?.avatar} | ||
| avatarID={accountID} | ||
| type={CONST.ICON_TYPE_AVATAR} | ||
| size={CONST.AVATAR_SIZE.X_LARGE} | ||
| fallbackIcon={personalDetails?.fallbackIcon} | ||
| /> | ||
| </OfflineWithFeedback> | ||
|
|
||
| {!!displayName && ( | ||
| <Text | ||
| style={[styles.textHeadline, styles.pre, styles.mb8, styles.w100, styles.textAlignCenter]} | ||
| numberOfLines={1} | ||
| > | ||
| {displayName} | ||
| </Text> | ||
| )} | ||
| </View> | ||
| <View style={styles.w100}> | ||
| <MenuItemWithTopDescription | ||
| title={copyableName} | ||
| copyValue={copyableName} | ||
| description={translate(isSMSLogin ? 'common.phoneNumber' : 'common.email')} | ||
| interactive={false} | ||
| copyable | ||
| /> | ||
| {children} | ||
| <MenuItem | ||
| style={styles.mb5} | ||
| title={translate('common.profile')} | ||
| icon={icons.Info} | ||
| onPress={() => Navigation.navigate(ROUTES.PROFILE.getRoute(accountID, Navigation.getActiveRoute()))} | ||
| shouldShowRightIcon | ||
| /> | ||
| </View> | ||
| </View> | ||
| </ScrollView> | ||
| </ScreenWrapper> | ||
| </DomainNotFoundPageWrapper> | ||
| ); | ||
| } | ||
|
|
||
| BaseDomainMemberDetailsComponent.displayName = 'BaseDomainMemberDetailsComponent'; | ||
|
|
||
| export default BaseDomainMemberDetailsComponent; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import React from 'react'; | ||
| import type {PlatformStackScreenProps} from '@navigation/PlatformStackNavigation/types'; | ||
| import type {SettingsNavigatorParamList} from '@navigation/types'; | ||
| import BaseDomainMemberDetailsComponent from '@pages/domain/BaseDomainMemberDetailsComponent'; | ||
| import type SCREENS from '@src/SCREENS'; | ||
|
|
||
| type DomainMemberDetailsPageProps = PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.DOMAIN.MEMBER_DETAILS>; | ||
|
|
||
| function DomainMemberDetailsPage({route}: DomainMemberDetailsPageProps) { | ||
| const {domainAccountID, accountID} = route.params; | ||
|
|
||
| return ( | ||
| <BaseDomainMemberDetailsComponent | ||
| domainAccountID={domainAccountID} | ||
| accountID={accountID} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| DomainMemberDetailsPage.displayName = 'DomainMemberDetailsPage'; | ||
|
|
||
| export default DomainMemberDetailsPage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all eslint disablings, there should be comment explaining why.
Can we move selector function to the top of the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no we can't, we need the
accountIDThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we discussed this in the past and there was a way to achieve this somehow 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @chrispader @TMisiukiewicz