1
+ import { Str } from 'expensify-common' ;
1
2
import React , { useCallback , useEffect , useMemo , useState } from 'react' ;
2
3
import { View } from 'react-native' ;
3
4
import { useOnyx } from 'react-native-onyx' ;
@@ -6,6 +7,7 @@ import type {ValueOf} from 'type-fest';
6
7
import Avatar from '@components/Avatar' ;
7
8
import Button from '@components/Button' ;
8
9
import ButtonDisabledWhenOffline from '@components/Button/ButtonDisabledWhenOffline' ;
10
+ import CommunicationsLink from '@components/CommunicationsLink' ;
9
11
import ConfirmModal from '@components/ConfirmModal' ;
10
12
import HeaderWithBackButton from '@components/HeaderWithBackButton' ;
11
13
import * as Expensicons from '@components/Icon/Expensicons' ;
@@ -15,6 +17,7 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback';
15
17
import ScreenWrapper from '@components/ScreenWrapper' ;
16
18
import ScrollView from '@components/ScrollView' ;
17
19
import Text from '@components/Text' ;
20
+ import UserDetailsTooltip from '@components/UserDetailsTooltip' ;
18
21
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
19
22
import useLocalize from '@hooks/useLocalize' ;
20
23
import usePrevious from '@hooks/usePrevious' ;
@@ -26,7 +29,7 @@ import {removeApprovalWorkflow as removeApprovalWorkflowAction, updateApprovalWo
26
29
import { getAllCardsForWorkspace , getCardFeedIcon , getCompanyFeeds , isExpensifyCardFullySetUp , maskCardNumber } from '@libs/CardUtils' ;
27
30
import { convertToDisplayString } from '@libs/CurrencyUtils' ;
28
31
import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
29
- import { getDisplayNameOrDefault } from '@libs/PersonalDetailsUtils' ;
32
+ import { getDisplayNameOrDefault , getPhoneNumber } from '@libs/PersonalDetailsUtils' ;
30
33
import shouldRenderTransferOwnerButton from '@libs/shouldRenderTransferOwnerButton' ;
31
34
import { convertPolicyEmployeesToApprovalWorkflows , updateWorkflowDataOnApproverRemoval } from '@libs/WorkflowUtils' ;
32
35
import Navigation from '@navigation/Navigation' ;
@@ -93,6 +96,9 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
93
96
const policyOwnerDisplayName = formatPhoneNumber ( getDisplayNameOrDefault ( ownerDetails ) ) ?? policy ?. owner ?? '' ;
94
97
const hasMultipleFeeds = Object . keys ( getCompanyFeeds ( cardFeeds , false , true ) ) . length > 0 ;
95
98
const workspaceCards = getAllCardsForWorkspace ( workspaceAccountID , cardList ) ;
99
+ const isSMSLogin = Str . isSMSLogin ( memberLogin ) ;
100
+ const phoneNumber = getPhoneNumber ( details ) ;
101
+ const phoneOrEmail = isSMSLogin ? getPhoneNumber ( details ) : memberLogin ;
96
102
97
103
const policyApproverEmail = policy ?. approver ;
98
104
const { approvalWorkflows} = useMemo (
@@ -309,8 +315,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
309
315
text = { translate ( 'workspace.people.transferOwner' ) }
310
316
onPress = { startChangeOwnershipFlow }
311
317
icon = { Expensicons . Transfer }
312
- iconStyles = { StyleUtils . getTransformScaleStyle ( 0.8 ) }
313
- style = { styles . mv5 }
318
+ style = { styles . mb5 }
314
319
/>
315
320
)
316
321
) : (
@@ -319,8 +324,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
319
324
onPress = { askForConfirmationToRemove }
320
325
isDisabled = { isSelectedMemberOwner || isSelectedMemberCurrentUser }
321
326
icon = { Expensicons . RemoveMembers }
322
- iconStyles = { StyleUtils . getTransformScaleStyle ( 0.8 ) }
323
- style = { styles . mv5 }
327
+ style = { styles . mb5 }
324
328
/>
325
329
) }
326
330
< ConfirmModal
@@ -335,6 +339,25 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
335
339
/>
336
340
</ View >
337
341
< View style = { styles . w100 } >
342
+ < View style = { [ styles . ph5 , styles . pv3 ] } >
343
+ < Text
344
+ style = { [ styles . textLabelSupporting , styles . mb1 ] }
345
+ numberOfLines = { 1 }
346
+ >
347
+ { translate ( isSMSLogin ? 'common.phoneNumber' : 'common.email' ) }
348
+ </ Text >
349
+ < CommunicationsLink value = { phoneOrEmail ?? '' } >
350
+ < UserDetailsTooltip accountID = { details ?. accountID ?? CONST . DEFAULT_NUMBER_ID } >
351
+ < Text
352
+ numberOfLines = { 1 }
353
+ style = { styles . w100 }
354
+ >
355
+ { isSMSLogin ? formatPhoneNumber ( phoneNumber ?? '' ) : memberLogin }
356
+ </ Text >
357
+ </ UserDetailsTooltip >
358
+ </ CommunicationsLink >
359
+ </ View >
360
+
338
361
< MenuItemWithTopDescription
339
362
disabled = { isSelectedMemberOwner || isSelectedMemberCurrentUser }
340
363
title = { translate ( `workspace.common.roleName` , { role : member ?. role } ) }
0 commit comments