Skip to content
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

Setup the new Send Money page and header titles #3860

Merged
merged 3 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creepin' on your PR :D Did you mean to also add a translation in es.js?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was planning on adding all the translations in one big translation PR at the end!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

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:',
},
reportDetailsPage: {
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 @@ -354,6 +355,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 @@ -76,6 +77,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 @@ -185,6 +195,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 @@ -104,6 +104,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') {
nickmurray47 marked this conversation as resolved.
Show resolved Hide resolved
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" />;