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

fix: do not show expensify card in the selector when not enabled #52553

Merged
Changes from all commits
Commits
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
40 changes: 21 additions & 19 deletions src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type WorkspaceMemberNewCardPageProps = WithPolicyAndFullscreenLoadingProps & Sta

function WorkspaceMemberNewCardPage({route, personalDetails}: WorkspaceMemberNewCardPageProps) {
const {policyID} = route.params;
const policy = PolicyUtils.getPolicy(policyID);
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);

const {translate} = useLocalize();
Expand Down Expand Up @@ -94,25 +95,26 @@ function WorkspaceMemberNewCardPage({route, personalDetails}: WorkspaceMemberNew
),
}));

const feeds = workspaceAccountID
? [
...companyCardFeeds,
{
value: CONST.EXPENSIFY_CARD.NAME,
text: translate('workspace.common.expensifyCard'),
keyForList: CONST.EXPENSIFY_CARD.NAME,
isSelected: selectedFeed === CONST.EXPENSIFY_CARD.NAME,
leftElement: (
<Icon
src={ExpensifyCardImage}
width={variables.cardIconWidth}
height={variables.cardIconHeight}
additionalStyles={[styles.cardIcon, styles.mr3]}
/>
),
},
]
: companyCardFeeds;
const feeds =
workspaceAccountID && policy?.areExpensifyCardsEnabled
? [
...companyCardFeeds,
{
value: CONST.EXPENSIFY_CARD.NAME,
text: translate('workspace.common.expensifyCard'),
keyForList: CONST.EXPENSIFY_CARD.NAME,
isSelected: selectedFeed === CONST.EXPENSIFY_CARD.NAME,
leftElement: (
<Icon
src={ExpensifyCardImage}
width={variables.cardIconWidth}
height={variables.cardIconHeight}
additionalStyles={[styles.cardIcon, styles.mr3]}
/>
),
},
]
: companyCardFeeds;

const goBack = () => Navigation.goBack();

Expand Down
Loading