-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[CP Staging] Fix/46963 hide card reconciliation button #46978
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -25,6 +25,7 @@ import ThreeDotsMenu from '@components/ThreeDotsMenu'; | |||||||
import type ThreeDotsMenuProps from '@components/ThreeDotsMenu/types'; | ||||||||
import useLocalize from '@hooks/useLocalize'; | ||||||||
import useNetwork from '@hooks/useNetwork'; | ||||||||
import usePermissions from '@hooks/usePermissions'; | ||||||||
import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||||||||
import useTheme from '@hooks/useTheme'; | ||||||||
import useThemeStyles from '@hooks/useThemeStyles'; | ||||||||
|
@@ -82,6 +83,7 @@ type AccountingIntegration = { | |||||||
pendingFields?: PendingFields<string>; | ||||||||
errorFields?: ErrorFields; | ||||||||
}; | ||||||||
|
||||||||
function accountingIntegrationData( | ||||||||
connectionName: PolicyConnectionName, | ||||||||
policyID: string, | ||||||||
|
@@ -214,6 +216,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { | |||||||
const [isDisconnectModalOpen, setIsDisconnectModalOpen] = useState(false); | ||||||||
const [datetimeToRelative, setDateTimeToRelative] = useState(''); | ||||||||
const threeDotsMenuContainerRef = useRef<View>(null); | ||||||||
const {canUseWorkspaceFeeds} = usePermissions(); | ||||||||
|
||||||||
const lastSyncProgressDate = parseISO(connectionSyncProgress?.timestamp ?? ''); | ||||||||
const isSyncInProgress = | ||||||||
|
@@ -350,6 +353,53 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { | |||||||
const shouldHideConfigurationOptions = isConnectionUnverified(policy, connectedIntegration); | ||||||||
const integrationData = accountingIntegrationData(connectedIntegration, policyID, translate, undefined, undefined, policy); | ||||||||
const iconProps = integrationData?.icon ? {icon: integrationData.icon, iconType: CONST.ICON_TYPE_AVATAR} : {}; | ||||||||
|
||||||||
const configurationOptions = [ | ||||||||
{ | ||||||||
icon: Expensicons.Pencil, | ||||||||
iconRight: Expensicons.ArrowRight, | ||||||||
shouldShowRightIcon: true, | ||||||||
title: translate('workspace.accounting.import'), | ||||||||
wrapperStyle: [styles.sectionMenuItemTopDescription], | ||||||||
onPress: integrationData?.onImportPagePress, | ||||||||
brickRoadIndicator: areSettingsInErrorFields(integrationData?.subscribedImportSettings, integrationData?.errorFields) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, | ||||||||
pendingAction: settingsPendingAction(integrationData?.subscribedImportSettings, integrationData?.pendingFields), | ||||||||
}, | ||||||||
{ | ||||||||
icon: Expensicons.Send, | ||||||||
iconRight: Expensicons.ArrowRight, | ||||||||
shouldShowRightIcon: true, | ||||||||
title: translate('workspace.accounting.export'), | ||||||||
wrapperStyle: [styles.sectionMenuItemTopDescription], | ||||||||
onPress: integrationData?.onExportPagePress, | ||||||||
brickRoadIndicator: areSettingsInErrorFields(integrationData?.subscribedExportSettings, integrationData?.errorFields) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, | ||||||||
pendingAction: settingsPendingAction(integrationData?.subscribedExportSettings, integrationData?.pendingFields), | ||||||||
}, | ||||||||
{ | ||||||||
icon: Expensicons.ExpensifyCard, | ||||||||
iconRight: Expensicons.ArrowRight, | ||||||||
shouldShowRightIcon: true, | ||||||||
title: translate('workspace.accounting.cardReconciliation'), | ||||||||
wrapperStyle: [styles.sectionMenuItemTopDescription], | ||||||||
onPress: integrationData?.onCardReconciliationPagePress, | ||||||||
}, | ||||||||
{ | ||||||||
icon: Expensicons.Gear, | ||||||||
iconRight: Expensicons.ArrowRight, | ||||||||
shouldShowRightIcon: true, | ||||||||
title: translate('workspace.accounting.advanced'), | ||||||||
wrapperStyle: [styles.sectionMenuItemTopDescription], | ||||||||
onPress: integrationData?.onAdvancedPagePress, | ||||||||
brickRoadIndicator: areSettingsInErrorFields(integrationData?.subscribedAdvancedSettings, integrationData?.errorFields) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, | ||||||||
pendingAction: settingsPendingAction(integrationData?.subscribedAdvancedSettings, integrationData?.pendingFields), | ||||||||
}, | ||||||||
]; | ||||||||
|
||||||||
// TODO: remove after this beta feature is released | ||||||||
if (!canUseWorkspaceFeeds) { | ||||||||
configurationOptions.splice(2, 1); | ||||||||
} | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we should also check here if Something like we do below: App/src/pages/workspace/WorkspaceInitialPage.tsx Lines 239 to 241 in 0a33186
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, exactly will add it in a minute There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @allgandalf fixed |
||||||||
|
||||||||
return [ | ||||||||
{ | ||||||||
...iconProps, | ||||||||
|
@@ -387,55 +437,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { | |||||||
), | ||||||||
}, | ||||||||
...(isEmptyObject(integrationSpecificMenuItems) || shouldShowSynchronizationError || isEmptyObject(policy?.connections) ? [] : [integrationSpecificMenuItems]), | ||||||||
...(isEmptyObject(policy?.connections) || shouldHideConfigurationOptions | ||||||||
? [] | ||||||||
: [ | ||||||||
{ | ||||||||
icon: Expensicons.Pencil, | ||||||||
iconRight: Expensicons.ArrowRight, | ||||||||
shouldShowRightIcon: true, | ||||||||
title: translate('workspace.accounting.import'), | ||||||||
wrapperStyle: [styles.sectionMenuItemTopDescription], | ||||||||
onPress: integrationData?.onImportPagePress, | ||||||||
brickRoadIndicator: areSettingsInErrorFields(integrationData?.subscribedImportSettings, integrationData?.errorFields) | ||||||||
? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR | ||||||||
: undefined, | ||||||||
pendingAction: settingsPendingAction(integrationData?.subscribedImportSettings, integrationData?.pendingFields), | ||||||||
}, | ||||||||
{ | ||||||||
icon: Expensicons.Send, | ||||||||
iconRight: Expensicons.ArrowRight, | ||||||||
shouldShowRightIcon: true, | ||||||||
title: translate('workspace.accounting.export'), | ||||||||
wrapperStyle: [styles.sectionMenuItemTopDescription], | ||||||||
onPress: integrationData?.onExportPagePress, | ||||||||
brickRoadIndicator: areSettingsInErrorFields(integrationData?.subscribedExportSettings, integrationData?.errorFields) | ||||||||
? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR | ||||||||
: undefined, | ||||||||
pendingAction: settingsPendingAction(integrationData?.subscribedExportSettings, integrationData?.pendingFields), | ||||||||
}, | ||||||||
{ | ||||||||
icon: Expensicons.ExpensifyCard, | ||||||||
iconRight: Expensicons.ArrowRight, | ||||||||
shouldShowRightIcon: true, | ||||||||
title: translate('workspace.accounting.cardReconciliation'), | ||||||||
wrapperStyle: [styles.sectionMenuItemTopDescription], | ||||||||
onPress: integrationData?.onCardReconciliationPagePress, | ||||||||
}, | ||||||||
|
||||||||
{ | ||||||||
icon: Expensicons.Gear, | ||||||||
iconRight: Expensicons.ArrowRight, | ||||||||
shouldShowRightIcon: true, | ||||||||
title: translate('workspace.accounting.advanced'), | ||||||||
wrapperStyle: [styles.sectionMenuItemTopDescription], | ||||||||
onPress: integrationData?.onAdvancedPagePress, | ||||||||
brickRoadIndicator: areSettingsInErrorFields(integrationData?.subscribedAdvancedSettings, integrationData?.errorFields) | ||||||||
? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR | ||||||||
: undefined, | ||||||||
pendingAction: settingsPendingAction(integrationData?.subscribedAdvancedSettings, integrationData?.pendingFields), | ||||||||
}, | ||||||||
]), | ||||||||
...(isEmptyObject(policy?.connections) || shouldHideConfigurationOptions ? [] : configurationOptions), | ||||||||
]; | ||||||||
}, [ | ||||||||
policy, | ||||||||
|
@@ -447,6 +449,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { | |||||||
styles.pb0, | ||||||||
styles.mt5, | ||||||||
styles.popoverMenuIcon, | ||||||||
canUseWorkspaceFeeds, | ||||||||
connectionSyncProgress?.stageInProgress, | ||||||||
datetimeToRelative, | ||||||||
theme.spinner, | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think we need this comment, we will go through all the usecases of the beta when it needs to be removed