Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f79edd0
fix: update how we show pending and scanning status
nkdengineer Nov 26, 2024
29cffee
Merge branch 'main' into fix/52921
nkdengineer Dec 2, 2024
1bde136
fix: style request preview content
nkdengineer Dec 2, 2024
2ca1154
Merge branch 'main' into fix/52921
nkdengineer Dec 19, 2024
37213ad
fix logic show pending
nkdengineer Dec 19, 2024
f868601
Merge branch 'main' into fix/52921
nkdengineer Dec 23, 2024
9440394
fix lint
nkdengineer Dec 23, 2024
980012c
fix lint
nkdengineer Dec 23, 2024
f08b0e0
fix lint
nkdengineer Dec 23, 2024
f51600b
fix lint
nkdengineer Dec 23, 2024
d9225c8
Not show receipt scan in progress
nkdengineer Dec 23, 2024
ab74606
fix: conflict and update
nkdengineer Dec 27, 2024
3ffed1e
Merge branch 'main' into fix/52921
nkdengineer Jan 6, 2025
9e99557
resolve conflict
nkdengineer Jan 7, 2025
1b28fd2
remove some pending message
nkdengineer Jan 7, 2025
607a73c
Merge branch 'main' into fix/52921
nkdengineer Jan 13, 2025
3b75e73
fix lint
nkdengineer Jan 13, 2025
596cbc0
fix lint
nkdengineer Jan 13, 2025
21ee3a2
fix lint
nkdengineer Jan 13, 2025
c7cd27c
remove console log
nkdengineer Jan 13, 2025
7c80348
Merge branch 'main' into fix/52921
nkdengineer Jan 15, 2025
41a538a
fix change logic show scanning report preview
nkdengineer Jan 15, 2025
ca56734
fix lint
nkdengineer Jan 15, 2025
fe20c85
resolve conflict
nkdengineer Jan 19, 2025
159c568
fix: report preivew message
nkdengineer Jan 20, 2025
b4c6ecb
Merge branch 'main' into fix/52921
nkdengineer Jan 22, 2025
64e267f
fix preview header text
nkdengineer Jan 22, 2025
47bb667
fix logic show preview message
nkdengineer Jan 24, 2025
25d060b
fix conflict
nkdengineer Jan 30, 2025
0ea81e2
resolve conflict
nkdengineer Feb 4, 2025
d0d8f90
Merge branch 'main' into fix/52921
nkdengineer Feb 5, 2025
226a37b
fix ts
nkdengineer Feb 5, 2025
194a676
resolve conflict
nkdengineer Feb 10, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {useOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import Button from '@components/Button';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import {ReceiptScan} from '@components/Icon/Expensicons';
import {Checkmark, DotIndicator, Folder, Hourglass, Tag} from '@components/Icon/Expensicons';
import MoneyRequestSkeletonView from '@components/MoneyRequestSkeletonView';
import MultipleAvatars from '@components/MultipleAvatars';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
Expand Down Expand Up @@ -51,7 +50,7 @@ import {
getTransactionViolations,
hasMissingSmartscanFields,
hasNoticeTypeViolation as hasNoticeTypeViolationTransactionUtils,
hasPendingUI,
hasPendingRTERViolation,
hasReceipt as hasReceiptTransactionUtils,
hasViolation as hasViolationTransactionUtils,
hasWarningTypeViolation as hasWarningTypeViolationTransactionUtils,
Expand Down Expand Up @@ -234,6 +233,14 @@ function MoneyRequestPreviewContent({
message = translate('iou.split');
}

if (isPending(transaction)) {
message += ` ${CONST.DOT_SEPARATOR} ${translate('iou.pending')}`;
Comment thread
nkdengineer marked this conversation as resolved.
}

if (hasPendingRTERViolation(getTransactionViolations(transactionID, transactionViolations))) {
message += ` ${CONST.DOT_SEPARATOR} ${translate('iou.pendingMatch')}`;
}

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

const getPendingMessageProps: () => PendingMessageProps = () => {
if (isScanning) {
return {shouldShow: true, messageIcon: ReceiptScan, messageDescription: translate('iou.receiptScanInProgress')};
}
if (isPending(transaction)) {
return {shouldShow: true, messageIcon: Expensicons.CreditCardHourglass, messageDescription: translate('iou.transactionPending')};
}
if (shouldShowBrokenConnectionViolation(transaction ? [transaction.transactionID] : [], iouReport, policy)) {
return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('violations.brokenConnection530Error')};
}
if (hasPendingUI(transaction, getTransactionViolations(transaction?.transactionID, transactionViolations))) {
return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('iou.pendingMatchWithCreditCard')};
return {shouldShow: true, messageIcon: Hourglass, messageDescription: translate('violations.brokenConnection530Error')};
}
return {shouldShow: false};
};
Expand All @@ -297,7 +295,7 @@ function MoneyRequestPreviewContent({

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

if (isFetchingWaypointsFromServer && !requestAmount) {
Expand Down Expand Up @@ -393,8 +391,9 @@ function MoneyRequestPreviewContent({
<Text style={[styles.textLabelSupporting, styles.flex1, styles.lh16]}>{getPreviewHeaderText()}</Text>
{!isSettled && shouldShowRBR && (
<Icon
src={Expensicons.DotIndicator}
src={DotIndicator}
fill={theme.danger}
small
/>
)}
</View>
Expand All @@ -420,7 +419,7 @@ function MoneyRequestPreviewContent({
{isSettledReportUtils(iouReport?.reportID) && !isPartialHold && !isBillSplit && (
<View style={styles.defaultCheckmarkWrapper}>
<Icon
src={Expensicons.Checkmark}
src={Checkmark}
fill={theme.iconSuccessFill}
/>
</View>
Expand Down Expand Up @@ -479,7 +478,7 @@ function MoneyRequestPreviewContent({
]}
>
<Icon
src={Expensicons.Folder}
src={Folder}
height={variables.iconSizeExtraSmall}
width={variables.iconSizeExtraSmall}
fill={theme.icon}
Expand All @@ -495,7 +494,7 @@ function MoneyRequestPreviewContent({
{shouldShowTag && (
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter, styles.gap1, category && styles.pl1]}>
<Icon
src={Expensicons.Tag}
src={Tag}
height={variables.iconSizeExtraSmall}
width={variables.iconSizeExtraSmall}
fill={theme.icon}
Expand Down
25 changes: 12 additions & 13 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ function ReportPreview({
return convertToDisplayString(totalDisplaySpend, iouReport?.currency);
}
if (isScanning) {
return translate('iou.receiptScanning', {count: numberOfScanningReceipts});
return translate('iou.receiptStatusTitle');
}
if (hasOnlyTransactionsWithPendingRoutes) {
return translate('iou.fieldPending');
Expand Down Expand Up @@ -367,7 +367,13 @@ function ReportPreview({

const previewMessage = useMemo(() => {
if (isScanning) {
return translate('common.receipt');
return totalDisplaySpend ? `${translate('common.receipt')} ${CONST.DOT_SEPARATOR} ${translate('common.scanning')}` : `${translate('common.receipt')}`;
}
if (numberOfPendingRequests === 1 && numberOfRequests === 1) {
return `${translate('common.receipt')} ${CONST.DOT_SEPARATOR} ${translate('iou.pending')}`;
}
if (showRTERViolationMessage) {
return `${translate('common.receipt')} ${CONST.DOT_SEPARATOR} ${translate('iou.pendingMatch')}`;
}

let payerOrApproverName;
Expand All @@ -392,6 +398,9 @@ function ReportPreview({
return translate(paymentVerb, {payer: payerOrApproverName});
}, [
isScanning,
numberOfPendingRequests,
numberOfRequests,
showRTERViolationMessage,
isPolicyExpenseChat,
isTripRoom,
isInvoiceRoom,
Expand All @@ -400,6 +409,7 @@ function ReportPreview({
iouReport?.isWaitingOnBankAccount,
hasNonReimbursableTransactions,
translate,
totalDisplaySpend,
chatReport,
policy,
invoiceReceiverPolicy,
Expand All @@ -425,8 +435,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 = isPayAtEndExpenseReport(iouReportID, transactions);
const [archiveReason] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, {selector: getArchiveReason});
Expand All @@ -444,18 +452,9 @@ function ReportPreview({
};
}
}
if (shouldShowScanningSubtitle) {
return {shouldShow: true, messageIcon: Expensicons.ReceiptScan, messageDescription: translate('iou.receiptScanInProgress')};
}
Comment thread
nkdengineer marked this conversation as resolved.
if (shouldShowPendingSubtitle) {
return {shouldShow: true, messageIcon: Expensicons.CreditCardHourglass, messageDescription: translate('iou.transactionPending')};
}
if (shouldShowBrokenConnectionViolation) {
return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('violations.brokenConnection530Error')};
}
if (showRTERViolationMessage) {
return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('iou.pendingMatchWithCreditCard')};
}
return {shouldShow: false};
};

Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ const translations = {
continue: 'Continue',
firstName: 'First name',
lastName: 'Last name',
scanning: 'Scanning',
addCardTermsOfService: 'Expensify Terms of Service',
perPerson: 'per person',
phone: 'Phone',
Expand Down Expand Up @@ -887,6 +888,7 @@ const translations = {
deleteReceipt: 'Delete receipt',
deletedTransaction: ({amount, merchant}: DeleteTransactionParams) => `deleted an expense on this report, ${merchant} - ${amount}`,
pendingMatchWithCreditCard: 'Receipt pending match with card transaction',
pendingMatch: 'Pending match',
pendingMatchWithCreditCardDescription: 'Receipt pending match with card transaction. Mark as cash to cancel.',
markAsCash: 'Mark as cash',
routePending: 'Route pending...',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ const translations = {
continue: 'Continuar',
firstName: 'Nombre',
lastName: 'Apellidos',
scanning: 'Escaneando',
phone: 'Teléfono',
phoneNumber: 'Número de teléfono',
phoneNumberPlaceholder: '(xxx) xxx-xxxx',
Expand Down Expand Up @@ -880,6 +881,7 @@ const translations = {
canceled: 'Canceló',
posted: 'Contabilizado',
deleteReceipt: 'Eliminar recibo',
pendingMatch: 'Pendiente de coincidencia',
pendingMatchWithCreditCard: 'Recibo pendiente de adjuntar con la transacción de la tarjeta',
pendingMatchWithCreditCardDescription: 'Recibo pendiente de adjuntar con la transacción de la tarjeta. Márcalo como efectivo para cancelar.',
markAsCash: 'Marcar como efectivo',
Expand Down