Skip to content

Commit

Permalink
update show of transfer owner
Browse files Browse the repository at this point in the history
  • Loading branch information
waterim committed Sep 27, 2024
1 parent 550d553 commit a123f2e
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {StackScreenProps} from '@react-navigation/stack';
import isEmpty from 'lodash/isEmpty';
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
Expand All @@ -24,6 +25,7 @@ import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import * as CardUtils from '@libs/CardUtils';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import getPlatform from '@libs/getPlatform';
import * as PolicyUtils from '@libs/PolicyUtils';
import Navigation from '@navigation/Navigation';
import type {SettingsNavigatorParamList} from '@navigation/types';
Expand Down Expand Up @@ -80,6 +82,11 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
const policyOwnerDisplayName = ownerDetails.displayName ?? policy?.owner ?? '';
const companyCards = CardUtils.getMemberCards(policy, allCardsList, accountID);

// To render correctly transfer owner button
const [fundList] = useOnyx(ONYXKEYS.FUND_LIST, {initialValue: {}});
const isNative = getPlatform() === CONST.PLATFORM.IOS || getPlatform() === CONST.PLATFORM.ANDROID;
const shouldShowTransferButton = !isNative || (isNative && !isEmpty(fundList));

// TODO: for now enabled for testing purposes. Change this to check for the actual multiple feeds when API is ready
const hasMultipleFeeds = policy?.areCompanyCardsEnabled;

Expand Down Expand Up @@ -240,14 +247,16 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
</Text>
)}
{isSelectedMemberOwner && isCurrentUserAdmin && !isCurrentUserOwner ? (
<Button
text={translate('workspace.people.transferOwner')}
onPress={startChangeOwnershipFlow}
isDisabled={isOffline}
icon={Expensicons.Transfer}
iconStyles={StyleUtils.getTransformScaleStyle(0.8)}
style={styles.mv5}
/>
shouldShowTransferButton && (
<Button
text={translate('workspace.people.transferOwner')}
onPress={startChangeOwnershipFlow}
isDisabled={isOffline}
icon={Expensicons.Transfer}
iconStyles={StyleUtils.getTransformScaleStyle(0.8)}
style={styles.mv5}
/>
)
) : (
<Button
text={translate('workspace.people.removeWorkspaceMemberButtonTitle')}
Expand Down

0 comments on commit a123f2e

Please sign in to comment.