From 1fccd7c1d73e237a769f93ef42c78f11caab1558 Mon Sep 17 00:00:00 2001 From: luthfi Date: Tue, 8 Mar 2022 18:19:03 +0700 Subject: [PATCH 1/2] Add workspace name as subtitle in individual modal screens --- src/pages/workspace/WorkspaceBankAccountPage.js | 5 +++++ src/pages/workspace/WorkspaceInvitePage.js | 3 +++ src/pages/workspace/WorkspaceMembersPage.js | 2 ++ src/pages/workspace/WorkspacePageWithSections.js | 5 +++++ 4 files changed, 15 insertions(+) diff --git a/src/pages/workspace/WorkspaceBankAccountPage.js b/src/pages/workspace/WorkspaceBankAccountPage.js index 48ca4143df95..78a6e845e0ec 100644 --- a/src/pages/workspace/WorkspaceBankAccountPage.js +++ b/src/pages/workspace/WorkspaceBankAccountPage.js @@ -19,12 +19,14 @@ import Section from '../../components/Section'; import WorkspaceResetBankAccountModal from './WorkspaceResetBankAccountModal'; import styles from '../../styles/styles'; import CONST from '../../CONST'; +import withFullPolicy, {fullPolicyPropTypes} from './withFullPolicy'; const propTypes = { /** ACH data for the withdrawal account actively being set up */ reimbursementAccount: reimbursementAccountPropTypes, ...withLocalizePropTypes, + ...fullPolicyPropTypes, }; const defaultProps = { @@ -86,11 +88,13 @@ class WorkspaceBankAccountPage extends React.Component { this.navigateToBankAccountRoute(); return null; } + const policyName = lodashGet(this.props.policy, 'name'); return ( Navigation.navigate(ROUTES.getWorkspaceInitialRoute(this.props.route.params.policyID))} shouldShowGetAssistanceButton @@ -137,4 +141,5 @@ export default compose( key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, }, }), + withFullPolicy, )(WorkspaceBankAccountPage); diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js index c6f837450da3..7defbe038f3e 100644 --- a/src/pages/workspace/WorkspaceInvitePage.js +++ b/src/pages/workspace/WorkspaceInvitePage.js @@ -242,12 +242,15 @@ class WorkspaceInvitePage extends React.Component { Boolean(this.state.userToInvite), this.state.searchValue, ); + const policyName = lodashGet(this.props.policy, 'name'); + return ( {({didScreenTransitionEnd}) => ( { this.clearErrors(); Navigation.dismissModal(); diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js index cb916ad25b4f..0d5e069b9fdc 100644 --- a/src/pages/workspace/WorkspaceMembersPage.js +++ b/src/pages/workspace/WorkspaceMembersPage.js @@ -252,11 +252,13 @@ class WorkspaceMembersPage extends React.Component { .sortBy(person => person.displayName.toLowerCase()) .value(); const policyID = lodashGet(this.props.route, 'params.policyID'); + const policyName = lodashGet(this.props.policy, 'name'); return ( Navigation.dismissModal()} onBackButtonPress={() => Navigation.navigate(ROUTES.getWorkspaceInitialRoute(policyID))} shouldShowGetAssistanceButton diff --git a/src/pages/workspace/WorkspacePageWithSections.js b/src/pages/workspace/WorkspacePageWithSections.js index a969a9b73acf..043b7d6ffabd 100644 --- a/src/pages/workspace/WorkspacePageWithSections.js +++ b/src/pages/workspace/WorkspacePageWithSections.js @@ -16,6 +16,7 @@ import BankAccount from '../../libs/models/BankAccount'; import reimbursementAccountPropTypes from '../ReimbursementAccount/reimbursementAccountPropTypes'; import userPropTypes from '../settings/userPropTypes'; import KeyboardAvoidingView from '../../components/KeyboardAvoidingView'; +import withFullPolicy, {fullPolicyDefaultProps} from './withFullPolicy'; const propTypes = { /** The text to display in the header */ @@ -47,6 +48,7 @@ const propTypes = { guidesCallTaskID: PropTypes.string, ...withLocalizePropTypes, + ...fullPolicyDefaultProps, }; const defaultProps = { @@ -68,12 +70,14 @@ class WorkspacePageWithSections extends React.Component { const hasVBA = achState === BankAccount.STATE.OPEN; const isUsingECard = lodashGet(this.props.user, 'isUsingExpensifyCard', false); const policyID = lodashGet(this.props.route, 'params.policyID'); + const policyName = lodashGet(this.props.policy, 'name'); return ( Date: Thu, 10 Mar 2022 09:27:46 +0700 Subject: [PATCH 2/2] resolve request changes --- src/pages/workspace/WorkspaceBankAccountPage.js | 9 +++++++-- src/pages/workspace/WorkspacePageWithSections.js | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/pages/workspace/WorkspaceBankAccountPage.js b/src/pages/workspace/WorkspaceBankAccountPage.js index 78a6e845e0ec..1a2af938ae9a 100644 --- a/src/pages/workspace/WorkspaceBankAccountPage.js +++ b/src/pages/workspace/WorkspaceBankAccountPage.js @@ -1,4 +1,5 @@ import lodashGet from 'lodash/get'; +import PropTypes from 'prop-types'; import React from 'react'; import {ScrollView} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -19,14 +20,18 @@ import Section from '../../components/Section'; import WorkspaceResetBankAccountModal from './WorkspaceResetBankAccountModal'; import styles from '../../styles/styles'; import CONST from '../../CONST'; -import withFullPolicy, {fullPolicyPropTypes} from './withFullPolicy'; +import withFullPolicy from './withFullPolicy'; const propTypes = { /** ACH data for the withdrawal account actively being set up */ reimbursementAccount: reimbursementAccountPropTypes, + /** Policy values needed in the component */ + policy: PropTypes.shape({ + name: PropTypes.string, + }).isRequired, + ...withLocalizePropTypes, - ...fullPolicyPropTypes, }; const defaultProps = { diff --git a/src/pages/workspace/WorkspacePageWithSections.js b/src/pages/workspace/WorkspacePageWithSections.js index 043b7d6ffabd..f5fa19fc6700 100644 --- a/src/pages/workspace/WorkspacePageWithSections.js +++ b/src/pages/workspace/WorkspacePageWithSections.js @@ -16,7 +16,7 @@ import BankAccount from '../../libs/models/BankAccount'; import reimbursementAccountPropTypes from '../ReimbursementAccount/reimbursementAccountPropTypes'; import userPropTypes from '../settings/userPropTypes'; import KeyboardAvoidingView from '../../components/KeyboardAvoidingView'; -import withFullPolicy, {fullPolicyDefaultProps} from './withFullPolicy'; +import withFullPolicy from './withFullPolicy'; const propTypes = { /** The text to display in the header */ @@ -47,8 +47,12 @@ const propTypes = { /** The guides call task ID to associate with the workspace page being shown */ guidesCallTaskID: PropTypes.string, + /** Policy values needed in the component */ + policy: PropTypes.shape({ + name: PropTypes.string, + }).isRequired, + ...withLocalizePropTypes, - ...fullPolicyDefaultProps, }; const defaultProps = {