-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Show IOU preview for send money flow #18981
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
Changes from 9 commits
8d681ce
a6b886c
89d18ef
42c8cfb
f6a494d
afd558e
dc7d3bd
448b184
120202e
d4f0f2b
dc611f1
cafb75d
7e437c9
42c4c59
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ import * as OptionsListUtils from '../../libs/OptionsListUtils'; | |
import * as ReportUtils from '../../libs/ReportUtils'; | ||
import * as Report from '../../libs/actions/Report'; | ||
import withLocalize, {withLocalizePropTypes} from '../withLocalize'; | ||
import * as CurrencyUtils from '../../libs/CurrencyUtils'; | ||
import * as ReportActionsUtils from '../../libs/ReportActionsUtils'; | ||
|
||
const propTypes = { | ||
/** All the data of the action */ | ||
|
@@ -100,8 +100,8 @@ const MoneyRequestAction = (props) => { | |
const formattedUserLogins = _.map(participants, (login) => OptionsListUtils.addSMSDomainIfPhoneNumber(login).toLowerCase()); | ||
const thread = ReportUtils.buildOptimisticChatReport( | ||
formattedUserLogins, | ||
props.translate('iou.threadReportName', { | ||
formattedAmount: CurrencyUtils.convertToDisplayString(lodashGet(props.action, 'originalMessage.amount', 0), lodashGet(props.action, 'originalMessage.currency', '')), | ||
props.translate(ReportActionsUtils.isSentMoneyReportAction(props.action) ? 'iou.threadSentMoneyReportName' : 'iou.threadRequestReportName', { | ||
formattedAmount: ReportActionsUtils.getFormattedAmount(props.action), | ||
comment: props.action.originalMessage.comment, | ||
}), | ||
'', | ||
|
@@ -123,6 +123,11 @@ const MoneyRequestAction = (props) => { | |
} | ||
}; | ||
|
||
const onReportPreviewPressed = () => { | ||
Report.openReport(props.requestReportID); | ||
Navigation.navigate(ROUTES.getReportRoute(props.requestReportID)); | ||
}; | ||
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. The report preview components is not fully used but I think it should have its own callback to make to separate the concerns |
||
|
||
let shouldShowPendingConversionMessage = false; | ||
if ( | ||
!_.isEmpty(props.iouReport) && | ||
|
@@ -155,7 +160,7 @@ const MoneyRequestAction = (props) => { | |
chatReportID={props.chatReportID} | ||
iouReportID={props.requestReportID} | ||
contextMenuAnchor={props.contextMenuAnchor} | ||
onViewDetailsPressed={onIOUPreviewPressed} | ||
onViewDetailsPressed={onReportPreviewPressed} | ||
checkIfContextMenuActive={props.checkIfContextMenuActive} | ||
isHovered={props.isHovered} | ||
/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,13 +185,17 @@ class ReportActionItem extends Component { | |
*/ | ||
renderItemContent(hovered = false) { | ||
let children; | ||
const originalMessage = lodashGet(this.props.action, 'originalMessage', {}); | ||
// Show the IOUPreview for when request was created, bill was split or money was sent | ||
if ( | ||
this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && | ||
this.props.action.originalMessage.type !== CONST.IOU.REPORT_ACTION_TYPE.DELETE && | ||
this.props.action.originalMessage.type !== CONST.IOU.REPORT_ACTION_TYPE.PAY | ||
originalMessage && | ||
(originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.CREATE || | ||
originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.SPLIT || | ||
(originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && originalMessage.IOUDetails)) | ||
Comment on lines
+194
to
+196
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 was going to suggest |
||
) { | ||
// There is no single iouReport for bill splits, so only 1:1 requests require an iouReportID | ||
const iouReportID = this.props.action.originalMessage.IOUReportID ? this.props.action.originalMessage.IOUReportID.toString() : '0'; | ||
const iouReportID = originalMessage.IOUReportID ? originalMessage.IOUReportID.toString() : '0'; | ||
|
||
children = ( | ||
<MoneyRequestAction | ||
|
Uh oh!
There was an error while loading. Please reload this page.