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

fix: update how we show pending and scanning status #53112

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ function MoneyRequestPreviewContent({
message = translate('iou.split');
}

if (TransactionUtils.hasPendingUI(transaction)) {
message += ` ${CONST.DOT_SEPARATOR} ${translate('iou.pending')}`;
}

if (isSettled && !iouReport?.isCancelledIOU && !isPartialHold) {
message += ` ${CONST.DOT_SEPARATOR} ${getSettledMessage()}`;
return message;
Expand Down Expand Up @@ -266,7 +270,7 @@ function MoneyRequestPreviewContent({

const getDisplayAmountText = (): string => {
if (isScanning) {
return translate('iou.receiptScanning');
return translate('iou.receiptStatusTitle');
}

if (isFetchingWaypointsFromServer && !requestAmount) {
Expand Down Expand Up @@ -364,6 +368,7 @@ function MoneyRequestPreviewContent({
<Icon
src={Expensicons.DotIndicator}
fill={theme.danger}
small
/>
)}
</View>
Expand Down
4 changes: 0 additions & 4 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ function ReportPreview({
const shouldShowSingleRequestMerchantOrDescription =
numberOfRequests === 1 && (!!formattedMerchant || !!formattedDescription) && !(hasOnlyTransactionsWithPendingRoutes && !totalDisplaySpend);
const shouldShowSubtitle = !isScanning && (shouldShowSingleRequestMerchantOrDescription || numberOfRequests > 1) && !isDisplayAmountZero(getDisplayAmount());
const shouldShowScanningSubtitle = (numberOfScanningReceipts === 1 && numberOfRequests === 1) || (numberOfScanningReceipts >= 1 && Number(nonHeldAmount) === 0);
const shouldShowPendingSubtitle = numberOfPendingRequests === 1 && numberOfRequests === 1;

const isPayAtEndExpense = ReportUtils.isPayAtEndExpenseReport(iouReportID, allTransactions);
Expand All @@ -399,9 +398,6 @@ function ReportPreview({
};
}
}
if (shouldShowScanningSubtitle) {
return {shouldShow: true, messageIcon: Expensicons.ReceiptScan, messageDescription: translate('iou.receiptScanInProgress')};
}
if (shouldShowPendingSubtitle) {
return {shouldShow: true, messageIcon: Expensicons.CreditCardHourglass, messageDescription: translate('iou.transactionPending')};
}
Expand Down
5 changes: 2 additions & 3 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,10 @@ function getLinkedTransactionID(reportActionOrID: string | OnyxEntry<ReportActio
return getOriginalMessage(reportAction)?.IOUTransactionID ?? null;
}

function getReportAction(reportID: string | undefined, reportActionID: string | undefined): ReportAction | undefined {
function getReportAction(reportID?: string, reportActionID?: string): ReportAction | undefined {
if (!reportID || !reportActionID) {
return undefined;
return;
}

return allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`]?.[reportActionID];
}

Expand Down
6 changes: 1 addition & 5 deletions src/libs/TransactionUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1059,11 +1059,7 @@ function removeSettledAndApprovedTransactions(transactionIDs: string[]) {
* 6. It returns the 'keep' and 'change' objects.
*/

function compareDuplicateTransactionFields(
reviewingTransactionID?: string | undefined,
reportID?: string | undefined,
selectedTransactionID?: string,
): {keep: Partial<ReviewDuplicates>; change: FieldsToChange} {
function compareDuplicateTransactionFields(reviewingTransactionID?: string, reportID?: string, selectedTransactionID?: string): {keep: Partial<ReviewDuplicates>; change: FieldsToChange} {
if (!reviewingTransactionID || !reportID) {
return {change: {}, keep: {}};
}
Expand Down
Loading