Skip to content

Commit

Permalink
integrate reportFieldsFeature beta
Browse files Browse the repository at this point in the history
  • Loading branch information
rezkiy37 committed Jun 19, 2024
1 parent 335e7f1 commit eab52fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ const CONST = {
SPOTNANA_TRAVEL: 'spotnanaTravel',
ACCOUNTING_ON_NEW_EXPENSIFY: 'accountingOnNewExpensify',
XERO_ON_NEW_EXPENSIFY: 'xeroOnNewExpensify',
REPORT_FIELDS_FEATURE: 'reportFieldsFeature',
},
BUTTON_STATES: {
DEFAULT: 'default',
Expand Down
5 changes: 5 additions & 0 deletions src/libs/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function canUseXeroIntegration(betas: OnyxEntry<Beta[]>): boolean {
return !!betas?.includes(CONST.BETAS.XERO_ON_NEW_EXPENSIFY) || canUseAllBetas(betas);
}

function canUseReportFieldsFeature(betas: OnyxEntry<Beta[]>): boolean {
return !!betas?.includes(CONST.BETAS.REPORT_FIELDS_FEATURE) || canUseAllBetas(betas);
}

/**
* Link previews are temporarily disabled.
*/
Expand All @@ -67,4 +71,5 @@ export default {
canUseSpotnanaTravel,
canUseAccountingIntegrations,
canUseXeroIntegration,
canUseReportFieldsFeature,
};
11 changes: 7 additions & 4 deletions src/pages/workspace/WorkspaceMoreFeaturesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function WorkspaceMoreFeaturesPage({policy, route}: WorkspaceMoreFeaturesPagePro
const styles = useThemeStyles();
const {isSmallScreenWidth} = useWindowDimensions();
const {translate} = useLocalize();
const {canUseAccountingIntegrations} = usePermissions();
const {canUseAccountingIntegrations, canUseReportFieldsFeature} = usePermissions();
const hasAccountingConnection = !!policy?.areConnectionsEnabled && !isEmptyObject(policy?.connections);
const isSyncTaxEnabled = !!policy?.connections?.quickbooksOnline?.config?.syncTax || !!policy?.connections?.xero?.config?.importTaxRates;
const policyID = policy?.id ?? '';
Expand Down Expand Up @@ -134,7 +134,10 @@ function WorkspaceMoreFeaturesPage({policy, route}: WorkspaceMoreFeaturesPagePro
Policy.enablePolicyTaxes(policy?.id ?? '-1', isEnabled);
},
},
{
];

if (canUseReportFieldsFeature) {
organizeItems.push({
icon: Illustrations.Pencil,
titleTranslationKey: 'workspace.moreFeatures.reportFields.title',
subtitleTranslationKey: 'workspace.moreFeatures.reportFields.subtitle',
Expand All @@ -152,8 +155,8 @@ function WorkspaceMoreFeaturesPage({policy, route}: WorkspaceMoreFeaturesPagePro
}
setIsReportFieldsWarningModalOpen(true);
},
},
];
});
}

const integrateItems: Item[] = [
{
Expand Down

0 comments on commit eab52fb

Please sign in to comment.