From 9912dbb9262bd40f1af527c41e7521a0abaafd56 Mon Sep 17 00:00:00 2001 From: mateusbra Date: Wed, 4 May 2022 08:41:04 -0300 Subject: [PATCH 1/3] merge workspace/reimburse pages --- .../reimburse/WorkspaceReimbursePage.js | 11 +-- .../reimburse/WorkspaceReimburseVBAView.js | 70 ------------------- ...NoVBAView.js => WorkspaceReimburseView.js} | 68 ++++++++++++------ 3 files changed, 48 insertions(+), 101 deletions(-) delete mode 100644 src/pages/workspace/reimburse/WorkspaceReimburseVBAView.js rename src/pages/workspace/reimburse/{WorkspaceReimburseNoVBAView.js => WorkspaceReimburseView.js} (75%) diff --git a/src/pages/workspace/reimburse/WorkspaceReimbursePage.js b/src/pages/workspace/reimburse/WorkspaceReimbursePage.js index 840dda1fcdab..2f0e8a9e3816 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimbursePage.js +++ b/src/pages/workspace/reimburse/WorkspaceReimbursePage.js @@ -1,8 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; -import WorkspaceReimburseNoVBAView from './WorkspaceReimburseNoVBAView'; -import WorkspaceReimburseVBAView from './WorkspaceReimburseVBAView'; +import WorkspaceReimburseView from './WorkspaceReimburseView'; import WorkspacePageWithSections from '../WorkspacePageWithSections'; import CONST from '../../../CONST'; @@ -26,13 +25,7 @@ const WorkspaceReimbursePage = props => ( guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_REIMBURSE} > {(hasVBA, policyID) => ( - <> - {!hasVBA ? ( - - ) : ( - - )} - + )} ); diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseVBAView.js b/src/pages/workspace/reimburse/WorkspaceReimburseVBAView.js deleted file mode 100644 index 919c340b4079..000000000000 --- a/src/pages/workspace/reimburse/WorkspaceReimburseVBAView.js +++ /dev/null @@ -1,70 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import PropTypes from 'prop-types'; -import Text from '../../../components/Text'; -import styles from '../../../styles/styles'; -import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; -import * as Expensicons from '../../../components/Icon/Expensicons'; -import * as Illustrations from '../../../components/Icon/Illustrations'; -import Section from '../../../components/Section'; -import CopyTextToClipboard from '../../../components/CopyTextToClipboard'; -import * as Link from '../../../libs/actions/Link'; - -const propTypes = { - /** The policy ID currently being configured */ - policyID: PropTypes.string.isRequired, - - ...withLocalizePropTypes, -}; - -const WorkspaceReimburseVBAView = props => ( - <> -
Link.openOldDotLink(`expenses?policyIDList=${props.policyID}&billableReimbursable=reimbursable&submitterEmail=%2B%2B`), - icon: Expensicons.Receipt, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - }, - ]} - > - - - {props.translate('workspace.reimburse.captureNoVBACopyBeforeEmail')} - - {props.translate('workspace.reimburse.captureNoVBACopyAfterEmail')} - - -
- -
Link.openOldDotLink(`reports?policyID=${props.policyID}&from=all&type=expense&showStates=Archived&isAdvancedFilterMode=true`), - icon: Expensicons.Bank, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - }, - ]} - > - - {props.translate('workspace.reimburse.fastReimbursementsVBACopy')} - -
- -); - -WorkspaceReimburseVBAView.propTypes = propTypes; -WorkspaceReimburseVBAView.displayName = 'WorkspaceReimburseVBAView'; - -export default withLocalize(WorkspaceReimburseVBAView); diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseNoVBAView.js b/src/pages/workspace/reimburse/WorkspaceReimburseView.js similarity index 75% rename from src/pages/workspace/reimburse/WorkspaceReimburseNoVBAView.js rename to src/pages/workspace/reimburse/WorkspaceReimburseView.js index f36f63b87698..74f6b24ef47f 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimburseNoVBAView.js +++ b/src/pages/workspace/reimburse/WorkspaceReimburseView.js @@ -27,6 +27,9 @@ const propTypes = { /** The policy ID currently being configured */ policyID: PropTypes.string.isRequired, + /** Does the user has a VBA into its account? */ + hasVBA: PropTypes.bool.isRequired, + /** Policy values needed in the component */ policy: PropTypes.shape({ customUnit: PropTypes.shape({ @@ -45,7 +48,7 @@ const propTypes = { ...withLocalizePropTypes, }; -class WorkspaceReimburseNoVBAView extends React.Component { +class WorkspaceReimburseView extends React.Component { constructor(props) { super(props); this.state = { @@ -188,31 +191,52 @@ class WorkspaceReimburseNoVBAView extends React.Component { -
- - {this.props.translate('workspace.reimburse.unlockNoVBACopy')} - -
+ {!this.props.hasVBA ? ( +
+ + {this.props.translate('workspace.reimburse.unlockNoVBACopy')} + +
+ ) + : ( +
Link.openOldDotLink(`reports?policyID=${this.props.policyID}&from=all&type=expense&showStates=Archived&isAdvancedFilterMode=true`), + icon: Expensicons.Bank, + shouldShowRightIcon: true, + iconRight: Expensicons.NewWindow, + }, + ]} + > + + {this.props.translate('workspace.reimburse.fastReimbursementsVBACopy')} + +
+ )} ); } } -WorkspaceReimburseNoVBAView.propTypes = propTypes; -WorkspaceReimburseNoVBAView.displayName = 'WorkspaceReimburseNoVBAView'; +WorkspaceReimburseView.propTypes = propTypes; +WorkspaceReimburseView.displayName = 'WorkspaceReimburseView'; export default compose( withFullPolicy, @@ -222,4 +246,4 @@ export default compose( key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, }, }), -)(WorkspaceReimburseNoVBAView); +)(WorkspaceReimburseView); From 2161ab38de60eb15569b8c5e411d321afb4daa75 Mon Sep 17 00:00:00 2001 From: mateusbra Date: Thu, 5 May 2022 10:59:56 -0300 Subject: [PATCH 2/3] break ternary into two expressions --- .../reimburse/WorkspaceReimburseView.js | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseView.js b/src/pages/workspace/reimburse/WorkspaceReimburseView.js index 74f6b24ef47f..2fcb8daf0314 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimburseView.js +++ b/src/pages/workspace/reimburse/WorkspaceReimburseView.js @@ -191,7 +191,7 @@ class WorkspaceReimburseView extends React.Component { - {!this.props.hasVBA ? ( + {Boolean(!this.props.hasVBA) && (
- ) - : ( -
Link.openOldDotLink(`reports?policyID=${this.props.policyID}&from=all&type=expense&showStates=Archived&isAdvancedFilterMode=true`), - icon: Expensicons.Bank, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - }, - ]} - > - - {this.props.translate('workspace.reimburse.fastReimbursementsVBACopy')} - -
- )} + )} + {Boolean(this.props.hasVBA) && ( +
Link.openOldDotLink(`reports?policyID=${this.props.policyID}&from=all&type=expense&showStates=Archived&isAdvancedFilterMode=true`), + icon: Expensicons.Bank, + shouldShowRightIcon: true, + iconRight: Expensicons.NewWindow, + }, + ]} + > + + {this.props.translate('workspace.reimburse.fastReimbursementsVBACopy')} + +
+ )} ); } From 21ca90f1739dd0556bb4b23588b296829957a825 Mon Sep 17 00:00:00 2001 From: mateusbra Date: Thu, 5 May 2022 11:16:46 -0300 Subject: [PATCH 3/3] remove Boolean casting --- src/pages/workspace/reimburse/WorkspaceReimburseView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseView.js b/src/pages/workspace/reimburse/WorkspaceReimburseView.js index 2fcb8daf0314..927401c46522 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimburseView.js +++ b/src/pages/workspace/reimburse/WorkspaceReimburseView.js @@ -191,7 +191,7 @@ class WorkspaceReimburseView extends React.Component { - {Boolean(!this.props.hasVBA) && ( + {!this.props.hasVBA && (