diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 52f35f035618..1da1813a3e3c 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -98,6 +98,7 @@ import type {PaymentMethod} from './KYCWall/types'; import LoadingBar from './LoadingBar'; import Modal from './Modal'; import MoneyReportHeaderStatusBar from './MoneyReportHeaderStatusBar'; +import MoneyReportHeaderStatusBarSkeleton from './MoneyReportHeaderStatusBarSkeleton'; import type {MoneyRequestHeaderStatusBarProps} from './MoneyRequestHeaderStatusBar'; import MoneyRequestHeaderStatusBar from './MoneyRequestHeaderStatusBar'; import {useMoneyRequestReportContext} from './MoneyRequestReportView/MoneyRequestReportContext'; @@ -282,7 +283,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea const isSubmitterSameAsNextApprover = isReportOwner(moneyRequestReport) && nextApproverAccountID === moneyRequestReport?.ownerAccountID; const optimisticNextStep = isSubmitterSameAsNextApprover && policy?.preventSelfApproval ? buildOptimisticNextStepForPreventSelfApprovalsEnabled() : nextStep; - const shouldShowNextStep = isFromPaidPolicy && !!optimisticNextStep?.message?.length && !shouldShowStatusBar; + const shouldShowNextStep = isFromPaidPolicy && !isInvoiceReport && !shouldShowStatusBar; const bankAccountRoute = getBankAccountRoute(chatReport); const {nonHeldAmount, fullAmount, hasValidNonHeldAmount} = getNonHeldAndFullAmount(moneyRequestReport, shouldShowPayButton); const isAnyTransactionOnHold = hasHeldExpensesReportUtils(moneyRequestReport?.reportID); @@ -890,7 +891,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea /> )} - {shouldShowNextStep && } + {shouldShowNextStep && (optimisticNextStep?.message?.length ? : )} {!!statusBarProps && ( + + + + + + ); +} + +MoneyReportHeaderStatusBarSkeleton.displayName = 'MoneyReportHeaderStatusBarSkeleton'; + +export default MoneyReportHeaderStatusBarSkeleton; diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx index 133afd873a8f..174821ebedd3 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx @@ -54,6 +54,7 @@ import type * as OnyxTypes from '@src/types/onyx'; import {useMoneyRequestReportContext} from './MoneyRequestReportContext'; import MoneyRequestReportTransactionList from './MoneyRequestReportTransactionList'; import MoneyRequestViewReportFields from './MoneyRequestViewReportFields'; +import ReportActionsListLoadingSkeleton from './ReportActionsListLoadingSkeleton'; import SearchMoneyRequestReportEmptyState from './SearchMoneyRequestReportEmptyState'; /** @@ -553,6 +554,7 @@ function MoneyRequestReportActionsList({ newTransactions={newTransactions} reportActions={reportActions} hasComments={reportHasComments} + isLoadingInitialReportActions={isLoadingInitialReportActions} scrollToNewTransaction={scrollToNewTransaction} /> @@ -561,6 +563,7 @@ function MoneyRequestReportActionsList({ onScroll={trackVerticalScrolling} contentContainerStyle={[shouldUseNarrowLayout ? styles.pt4 : styles.pt2]} ref={reportScrollManager.ref} + ListEmptyComponent={isLoadingInitialReportActions ? : undefined} // This skeleton component is only used for loading state, the empty state is handled by SearchMoneyRequestReportEmptyState /> )} diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx index e9b7cd83772b..5be100f48599 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx @@ -2,6 +2,7 @@ import {useFocusEffect} from '@react-navigation/native'; import isEmpty from 'lodash/isEmpty'; import React, {memo, useCallback, useMemo, useState} from 'react'; import {View} from 'react-native'; +import Animated, {FadeIn, FadeOut} from 'react-native-reanimated'; import type {TupleToUnion} from 'type-fest'; import {getButtonRole} from '@components/Button/utils'; import Checkbox from '@components/Checkbox'; @@ -55,6 +56,9 @@ type MoneyRequestReportTransactionListProps = { /** Whether the report that these transactions belong to has any chat comments */ hasComments: boolean; + /** Whether the report actions are being loaded, used to show 'Comments' during loading state */ + isLoadingInitialReportActions?: boolean; + /** scrollToNewTransaction callback used for scrolling to new transaction when it is created */ scrollToNewTransaction: (offset: number) => void; }; @@ -97,7 +101,15 @@ const getTransactionKey = (transaction: OnyxTypes.Transaction, key: SortableColu return key === CONST.SEARCH.TABLE_COLUMNS.DATE ? dateKey : key; }; -function MoneyRequestReportTransactionList({report, transactions, newTransactions, reportActions, hasComments, scrollToNewTransaction}: MoneyRequestReportTransactionListProps) { +function MoneyRequestReportTransactionList({ + report, + transactions, + newTransactions, + reportActions, + hasComments, + isLoadingInitialReportActions: isLoadingReportActions, + scrollToNewTransaction, +}: MoneyRequestReportTransactionListProps) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); const {translate} = useLocalize(); @@ -292,7 +304,13 @@ function MoneyRequestReportTransactionList({report, transactions, newTransaction )} - {hasComments ? translate('common.comments') : ''} + + {hasComments || isLoadingReportActions ? translate('common.comments') : ''} + {translate('common.total')} diff --git a/src/components/MoneyRequestReportView/ReportActionsListLoadingSkeleton.tsx b/src/components/MoneyRequestReportView/ReportActionsListLoadingSkeleton.tsx new file mode 100644 index 000000000000..b5bece629b5d --- /dev/null +++ b/src/components/MoneyRequestReportView/ReportActionsListLoadingSkeleton.tsx @@ -0,0 +1,18 @@ +import React from 'react'; +import Animated, {FadeIn, FadeOut} from 'react-native-reanimated'; +import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView'; + +function ReportActionsListLoadingSkeleton() { + return ( + + + + ); +} + +ReportActionsListLoadingSkeleton.displayName = 'ReportActionsListLoadingSkeleton'; + +export default ReportActionsListLoadingSkeleton; diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 9071d45185e1..a1ef9731b40b 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -828,6 +828,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) { newTransactions={newTransactions} hasOlderActions={hasOlderActions} hasNewerActions={hasNewerActions} + isLoadingInitialReportActions={reportMetadata?.isLoadingInitialReportActions} /> ) : null} {isCurrentReportLoadedFromOnyx ? (