diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index d1222b322ac50..5a349171be751 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -219,37 +219,14 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac }); } - if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_WORKFLOWS_ENABLED]) { - protectedMenuItems.push({ - translationKey: 'workspace.common.workflows', - icon: Workflows, - action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_WORKFLOWS.getRoute(policyID)))), - screenName: SCREENS.WORKSPACE.WORKFLOWS, - brickRoadIndicator: !isEmptyObject(policy?.errorFields?.reimburser ?? {}) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - highlighted: highlightedFeature === CONST.POLICY.MORE_FEATURES.ARE_WORKFLOWS_ENABLED, - }); - } - - if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_RULES_ENABLED]) { - protectedMenuItems.push({ - translationKey: 'workspace.common.rules', - icon: Feed, - action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_RULES.getRoute(policyID)))), - screenName: SCREENS.WORKSPACE.RULES, - highlighted: highlightedFeature === CONST.POLICY.MORE_FEATURES.ARE_RULES_ENABLED, - }); - } - - if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_INVOICES_ENABLED]) { - const currencyCode = policy?.outputCurrency ?? CONST.CURRENCY.USD; - + if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED]) { protectedMenuItems.push({ - translationKey: 'workspace.common.invoices', - icon: InvoiceGeneric, - action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_INVOICES.getRoute(policyID)))), - screenName: SCREENS.WORKSPACE.INVOICES, - badgeText: convertToDisplayString(policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0, currencyCode), - highlighted: highlightedFeature === CONST.POLICY.MORE_FEATURES.ARE_INVOICES_ENABLED, + translationKey: 'workspace.common.accounting', + icon: Sync, + action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING.getRoute(policyID)))), + brickRoadIndicator: hasSyncError || shouldShowQBOReimbursableExportDestinationAccountError(policy) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + screenName: SCREENS.WORKSPACE.ACCOUNTING.ROOT, + highlighted: highlightedFeature === CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED, }); } @@ -295,14 +272,36 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac }); } - if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED]) { + if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_WORKFLOWS_ENABLED]) { protectedMenuItems.push({ - translationKey: 'workspace.common.accounting', - icon: Sync, - action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING.getRoute(policyID)))), - brickRoadIndicator: hasSyncError || shouldShowQBOReimbursableExportDestinationAccountError(policy) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - screenName: SCREENS.WORKSPACE.ACCOUNTING.ROOT, - highlighted: highlightedFeature === CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED, + translationKey: 'workspace.common.workflows', + icon: Workflows, + action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_WORKFLOWS.getRoute(policyID)))), + screenName: SCREENS.WORKSPACE.WORKFLOWS, + brickRoadIndicator: !isEmptyObject(policy?.errorFields?.reimburser ?? {}) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + highlighted: highlightedFeature === CONST.POLICY.MORE_FEATURES.ARE_WORKFLOWS_ENABLED, + }); + } + + if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_RULES_ENABLED]) { + protectedMenuItems.push({ + translationKey: 'workspace.common.rules', + icon: Feed, + action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_RULES.getRoute(policyID)))), + screenName: SCREENS.WORKSPACE.RULES, + highlighted: highlightedFeature === CONST.POLICY.MORE_FEATURES.ARE_RULES_ENABLED, + }); + } + + if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_INVOICES_ENABLED]) { + const currencyCode = policy?.outputCurrency ?? CONST.CURRENCY.USD; + protectedMenuItems.push({ + translationKey: 'workspace.common.invoices', + icon: InvoiceGeneric, + action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_INVOICES.getRoute(policyID)))), + screenName: SCREENS.WORKSPACE.INVOICES, + badgeText: convertToDisplayString(policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0, currencyCode), + highlighted: highlightedFeature === CONST.POLICY.MORE_FEATURES.ARE_INVOICES_ENABLED, }); }