Skip to content

Commit

Permalink
Merge pull request #39048 from ShridharGoel/status-message
Browse files Browse the repository at this point in the history
Add status messages in money request previews
  • Loading branch information
robertjchen authored Mar 28, 2024
2 parents ff7a509 + 79598cf commit a202298
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,29 @@ function MoneyRequestPreviewContent({
};

const getPreviewHeaderText = (): string => {
if (isDistanceRequest) {
return translate('common.distance');
}

if (isScanning) {
return translate('common.receipt');
}
let message = translate('iou.cash');

if (isBillSplit) {
return translate('iou.split');
if (isDistanceRequest) {
message = translate('common.distance');
} else if (isScanning) {
message = translate('common.receipt');
} else if (isBillSplit) {
message = translate('iou.split');
}

if (isCardTransaction) {
let message = translate('iou.card');
message = translate('iou.card');
if (TransactionUtils.isPending(transaction)) {
message += ` • ${translate('iou.pending')}`;
return message;
}
}

if (isSettled && !iouReport?.isCancelledIOU) {
message += ` • ${getSettledMessage()}`;
return message;
}

let message = translate('iou.cash');
if (shouldShowRBR && transaction) {
const violations = TransactionUtils.getTransactionViolations(transaction.transactionID, transactionViolations);
if (violations?.[0]) {
Expand Down Expand Up @@ -240,9 +242,7 @@ function MoneyRequestPreviewContent({
<View style={styles.expenseAndReportPreviewTextButtonContainer}>
<View style={styles.expenseAndReportPreviewTextContainer}>
<View style={[styles.flexRow]}>
<Text style={[styles.textLabelSupporting, styles.flex1, styles.lh16]}>
{getPreviewHeaderText() + (isSettled && !iouReport?.isCancelledIOU ? ` • ${getSettledMessage()}` : '')}
</Text>
<Text style={[styles.textLabelSupporting, styles.flex1, styles.lh16]}>{getPreviewHeaderText()}</Text>
{!isSettled && shouldShowRBR && (
<Icon
src={Expensicons.DotIndicator}
Expand Down

0 comments on commit a202298

Please sign in to comment.