Skip to content

Commit

Permalink
Merge pull request #3860 from Expensify/nmurray-add-sendmoney-page
Browse files Browse the repository at this point in the history
Setup the new Send Money page and header titles
  • Loading branch information
Nicholas Murray authored Jul 2, 2021
2 parents 824e85f + 0c1471d commit bfc14ce
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default {
IOU_BILL: 'iou/split/:reportID',
getIouRequestRoute: reportID => `iou/request/${reportID}`,
getIouSplitRoute: reportID => `iou/split/${reportID}`,
IOU_SEND: 'iou/send/:reportID',
getIOUSendRoute: reportID => `/iou/send/${reportID}`,
IOU_SEND_CURRENCY: 'iou/send/:reportID/currency',
getIouSendCurrencyRoute: reportID => `iou/send/${reportID}/currency`,
IOU_DETAILS: 'iou/details',
IOU_DETAILS_WITH_IOU_REPORT_ID: 'iou/details/:chatReportID/:iouReportID/',
getIouDetailsRoute: (chatReportID, iouReportID) => `iou/details/${chatReportID}/${iouReportID}`,
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export default {
confirm: 'Confirm',
splitBill: 'Split Bill',
requestMoney: 'Request Money',
sendMoney: 'Send Money',
pay: 'Pay',
viewDetails: 'View Details',
settleExpensify: 'Pay with Expensify',
Expand All @@ -147,6 +148,7 @@ export default {
owes: ({manager, owner}) => `${manager} owes ${owner}`,
paid: ({owner, manager}) => `${manager} paid ${owner}`,
split: ({amount}) => `Split ${amount}`,
send: ({amount}) => `Send ${amount}`,
choosePaymentMethod: 'Choose payment method:',
noReimbursableExpenses: 'This report has an invalid amount',
},
Expand Down
7 changes: 7 additions & 0 deletions src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import ValidateLoginPage from '../../../pages/ValidateLoginPage';
import {
IOUBillStackNavigator,
IOURequestModalStackNavigator,
IOUSendModalStackNavigator,
IOUDetailsModalStackNavigator,
DetailsModalStackNavigator,
ReportParticipantsModalStackNavigator,
Expand Down Expand Up @@ -359,6 +360,12 @@ class AuthScreens extends React.Component {
component={RequestCallModalStackNavigator}
listeners={modalScreenListeners}
/>
<RootStack.Screen
name="IOU_Send"
options={modalScreenOptions}
component={IOUSendModalStackNavigator}
listeners={modalScreenListeners}
/>
</RootStack.Navigator>
);
}
Expand Down
11 changes: 11 additions & 0 deletions src/libs/Navigation/AppNavigator/ModalStackNavigators.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import SearchPage from '../../../pages/SearchPage';
import DetailsPage from '../../../pages/DetailsPage';
import IOURequestPage from '../../../pages/iou/IOURequestPage';
import IOUBillPage from '../../../pages/iou/IOUBillPage';
import IOUSendPage from '../../../pages/iou/IOUSendPage';
import IOUDetailsModal from '../../../pages/iou/IOUDetailsModal';
import SettingsInitialPage from '../../../pages/settings/InitialPage';
import SettingsProfilePage from '../../../pages/settings/Profile/ProfilePage';
Expand Down Expand Up @@ -77,6 +78,15 @@ const IOURequestModalStackNavigator = createModalStackNavigator([{
name: 'IOU_Request_Currency',
}]);

const IOUSendModalStackNavigator = createModalStackNavigator([{
Component: IOUSendPage,
name: 'IOU_Send_Root',
},
{
Component: IOUCurrencySelection,
name: 'IOU_Send_Currency',
}]);

const IOUDetailsModalStackNavigator = createModalStackNavigator([{
Component: IOUDetailsModal,
name: 'IOU_Details_Root',
Expand Down Expand Up @@ -190,6 +200,7 @@ const RequestCallModalStackNavigator = createModalStackNavigator([{
export {
IOUBillStackNavigator,
IOURequestModalStackNavigator,
IOUSendModalStackNavigator,
IOUDetailsModalStackNavigator,
DetailsModalStackNavigator,
ReportDetailsModalStackNavigator,
Expand Down
6 changes: 6 additions & 0 deletions src/libs/Navigation/linkingConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ export default {
IOU_Bill_Currency: ROUTES.IOU_BILL_CURRENCY,
},
},
IOU_Send: {
screens: {
IOU_Send_Root: ROUTES.IOU_SEND,
IOU_Send_Currency: ROUTES.IOU_SEND_CURRENCY,
},
},
IOU_Details: {
screens: {
IOU_Details_Root: ROUTES.IOU_DETAILS_WITH_IOU_REPORT_ID,
Expand Down
25 changes: 19 additions & 6 deletions src/pages/iou/IOUModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const propTypes = {
/** Whether the IOU is for a single request or a group bill split */
hasMultipleParticipants: PropTypes.bool,

/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report passed via the route */
report: PropTypes.shape({
/** Participants associated with current report */
Expand Down Expand Up @@ -81,6 +84,7 @@ const defaultProps = {
preferredCurrencyCode: CONST.CURRENCY.USD,
preferredCurrencySymbol: '$',
},
iouType: '',
};

// Determines type of step to display within Modal, value provides the title for that page.
Expand Down Expand Up @@ -159,18 +163,27 @@ class IOUModal extends Component {
getTitleForStep() {
const currentStepIndex = this.state.currentStepIndex;
if (currentStepIndex === 1 || currentStepIndex === 2) {
const formattedAmount = this.props.numberFormat(
this.state.amount, {
style: 'currency',
currency: this.state.selectedCurrency.currencyCode,
},
);
if (this.props.iouType === 'send') {
return this.props.translate('iou.send', {
amount: formattedAmount,
});
}
return this.props.translate(
this.props.hasMultipleParticipants ? 'iou.split' : 'iou.request', {
amount: this.props.numberFormat(
this.state.amount, {
style: 'currency',
currency: this.state.selectedCurrency.currencyCode,
},
),
amount: formattedAmount,
},
);
}
if (currentStepIndex === 0) {
if (this.props.iouType === 'send') {
return this.props.translate('iou.sendMoney');
}
return this.props.translate(this.props.hasMultipleParticipants ? 'iou.splitBill' : 'iou.requestMoney');
}

Expand Down
5 changes: 5 additions & 0 deletions src/pages/iou/IOUSendPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';
import IOUModal from './IOUModal';

// eslint-disable-next-line react/jsx-props-no-spreading
export default props => <IOUModal {...props} iouType="send" />;

0 comments on commit bfc14ce

Please sign in to comment.