@@ -28,7 +28,6 @@ import useHandleSelectionMode from '@hooks/useHandleSelectionMode';
2828import { useMemoizedLazyExpensifyIcons } from '@hooks/useLazyAsset' ;
2929import useLocalize from '@hooks/useLocalize' ;
3030import useMobileSelectionMode from '@hooks/useMobileSelectionMode' ;
31- import useNetwork from '@hooks/useNetwork' ;
3231import useOnyx from '@hooks/useOnyx' ;
3332import useReportIsArchived from '@hooks/useReportIsArchived' ;
3433import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
@@ -155,7 +154,6 @@ function MoneyRequestReportTransactionList({
155154 const [ isModalVisible , setIsModalVisible ] = useState ( false ) ;
156155 const [ selectedTransactionID , setSelectedTransactionID ] = useState < string > ( '' ) ;
157156 const { reportPendingAction} = getReportOfflinePendingActionAndErrors ( report ) ;
158- const { isOffline} = useNetwork ( ) ;
159157
160158 const isTaxEnabled = isPolicyTaxEnabled ( policy ) ;
161159 const { totalDisplaySpend, nonReimbursableSpend, reimbursableSpend} = getMoneyRequestSpendBreakdown ( report ) ;
@@ -565,36 +563,11 @@ function MoneyRequestReportTransactionList({
565563 [ groupByOptions , reportLayoutGroupBy , styles , windowHeight , isInLandscapeMode ] ,
566564 ) ;
567565
568- const isDesktopTableLayout = ! shouldUseNarrowLayout ;
569-
570566 const lastTransactionID = useMemo ( ( ) => {
571567 const allTransactions = shouldShowGroupedTransactions ? groupedTransactions . flatMap ( ( group ) => group . transactions ) : resolvedTransactions ;
572- const visibleTransactions = allTransactions . filter ( ( t ) => isOffline || ! isTransactionPendingDelete ( t ) ) ;
573- return visibleTransactions . at ( - 1 ) ?. transactionID ;
574- } , [ shouldShowGroupedTransactions , groupedTransactions , resolvedTransactions , isOffline ] ) ;
575-
576- const renderTransactionItem = ( transaction : TransactionWithOptionalHighlight ) => (
577- < MoneyRequestReportTransactionItem
578- key = { transaction . transactionID }
579- transaction = { transaction }
580- shouldBeHighlighted = { highlightedTransactionIDs . has ( transaction . transactionID ) }
581- columns = { columnsToShow }
582- report = { report }
583- policy = { policy }
584- isSelectionModeEnabled = { isMobileSelectionModeEnabled }
585- toggleTransaction = { toggleTransaction }
586- isSelected = { isTransactionSelected ( transaction . transactionID ) }
587- handleOnPress = { handleOnPress }
588- handleLongPress = { handleLongPress }
589- dateColumnSize = { dateColumnSize }
590- amountColumnSize = { amountColumnSize }
591- taxAmountColumnSize = { taxAmountColumnSize }
592- scrollToNewTransaction = { transaction . transactionID === newTransactions ?. at ( 0 ) ?. transactionID ? scrollToNewTransaction : undefined }
593- onArrowRightPress = { handleArrowRightPress }
594- nonPersonalAndWorkspaceCards = { nonPersonalAndWorkspaceCards ?? { } }
595- isLastItem = { ! showPendingExpensePlaceholder && transaction . transactionID === lastTransactionID }
596- />
597- ) ;
568+ const nonDeletedTransactions = allTransactions . filter ( ( t ) => ! isTransactionPendingDelete ( t ) ) ;
569+ return nonDeletedTransactions . at ( - 1 ) ?. transactionID ;
570+ } , [ shouldShowGroupedTransactions , groupedTransactions , resolvedTransactions ] ) ;
598571
599572 const transactionItems = shouldShowGroupedTransactions
600573 ? groupedTransactions . map ( ( group ) => {
@@ -604,8 +577,12 @@ function MoneyRequestReportTransactionList({
604577 isDisabled : false ,
605578 pendingAction : undefined ,
606579 } ;
580+
607581 return (
608- < View key = { group . groupKey } >
582+ < View
583+ key = { group . groupKey }
584+ style = { ! shouldUseNarrowLayout && styles . gap2 }
585+ >
609586 < MoneyRequestReportGroupHeader
610587 group = { group }
611588 groupKey = { group . groupKey }
@@ -619,17 +596,65 @@ function MoneyRequestReportTransactionList({
619596 pendingAction = { selectionState . pendingAction }
620597 shouldUseNarrowLayout = { shouldUseNarrowLayout }
621598 />
622- { group . transactions . map ( ( transaction ) => renderTransactionItem ( transaction ) ) }
599+ { group . transactions . map ( ( transaction ) => {
600+ const isLastItem = transaction . transactionID === lastTransactionID ;
601+ return (
602+ < MoneyRequestReportTransactionItem
603+ key = { transaction . transactionID }
604+ transaction = { transaction }
605+ shouldBeHighlighted = { highlightedTransactionIDs . has ( transaction . transactionID ) }
606+ columns = { columnsToShow }
607+ report = { report }
608+ policy = { policy }
609+ isSelectionModeEnabled = { isMobileSelectionModeEnabled }
610+ toggleTransaction = { toggleTransaction }
611+ isSelected = { isTransactionSelected ( transaction . transactionID ) }
612+ handleOnPress = { handleOnPress }
613+ handleLongPress = { handleLongPress }
614+ dateColumnSize = { dateColumnSize }
615+ amountColumnSize = { amountColumnSize }
616+ taxAmountColumnSize = { taxAmountColumnSize }
617+ scrollToNewTransaction = { transaction . transactionID === newTransactions ?. at ( 0 ) ?. transactionID ? scrollToNewTransaction : undefined }
618+ onArrowRightPress = { handleArrowRightPress }
619+ nonPersonalAndWorkspaceCards = { nonPersonalAndWorkspaceCards ?? { } }
620+ isLastItem = { isLastItem }
621+ />
622+ ) ;
623+ } ) }
623624 </ View >
624625 ) ;
625626 } )
626- : resolvedTransactions . map ( ( transaction ) => renderTransactionItem ( transaction ) ) ;
627+ : resolvedTransactions . map ( ( transaction ) => {
628+ const isLastItem = transaction . transactionID === lastTransactionID ;
629+ return (
630+ < MoneyRequestReportTransactionItem
631+ key = { transaction . transactionID }
632+ transaction = { transaction }
633+ shouldBeHighlighted = { highlightedTransactionIDs . has ( transaction . transactionID ) }
634+ columns = { columnsToShow }
635+ report = { report }
636+ policy = { policy }
637+ isSelectionModeEnabled = { isMobileSelectionModeEnabled }
638+ toggleTransaction = { toggleTransaction }
639+ isSelected = { isTransactionSelected ( transaction . transactionID ) }
640+ handleOnPress = { handleOnPress }
641+ handleLongPress = { handleLongPress }
642+ dateColumnSize = { dateColumnSize }
643+ amountColumnSize = { amountColumnSize }
644+ taxAmountColumnSize = { taxAmountColumnSize }
645+ scrollToNewTransaction = { transaction . transactionID === newTransactions ?. at ( 0 ) ?. transactionID ? scrollToNewTransaction : undefined }
646+ onArrowRightPress = { handleArrowRightPress }
647+ nonPersonalAndWorkspaceCards = { nonPersonalAndWorkspaceCards ?? { } }
648+ isLastItem = { isLastItem }
649+ />
650+ ) ;
651+ } ) ;
627652
628653 const narrowListWrapper = shouldUseNarrowLayout ? [ styles . highlightBG , styles . searchTableTopRadius , styles . searchTableBottomRadius , styles . overflowHidden ] : undefined ;
629654
630655 const transactionListContent = (
631656 < View
632- style = { [ listHorizontalPadding , shouldUseNarrowLayout ? styles . pb2 : styles . pb4 ] }
657+ style = { [ listHorizontalPadding , ! shouldUseNarrowLayout && styles . gap2 , shouldUseNarrowLayout ? styles . pb2 : styles . pb4 , ! shouldUseNarrowLayout && styles . mb2 ] }
633658 onLayout = { onLayout }
634659 >
635660 { narrowListWrapper ? < View style = { narrowListWrapper } > { transactionItems } </ View > : transactionItems }
@@ -648,27 +673,8 @@ function MoneyRequestReportTransactionList({
648673
649674 const tableHeaderContent = (
650675 < OfflineWithFeedback pendingAction = { reportPendingAction } >
651- < View
652- style = { [
653- styles . dFlex ,
654- styles . flexRow ,
655- ! isDesktopTableLayout && styles . pl5 ,
656- isDesktopTableLayout ? styles . pr11 : styles . pr16 ,
657- styles . alignItemsCenter ,
658- isDesktopTableLayout && [ styles . highlightBG , styles . searchTableTopRadius , styles . mh5 , styles . borderBottom ] ,
659- ] }
660- >
661- < View
662- style = { [
663- styles . dFlex ,
664- styles . flexRow ,
665- styles . alignItemsCenter ,
666- styles . pv2 ,
667- ! isDesktopTableLayout && styles . pr4 ,
668- StyleUtils . getPaddingLeft ( variables . w12 ) ,
669- isDesktopTableLayout && { minHeight : variables . tableGroupRowHeight } ,
670- ] }
671- >
676+ < View style = { [ styles . dFlex , styles . flexRow , styles . pl5 , styles . pr16 , styles . alignItemsCenter ] } >
677+ < View style = { [ styles . dFlex , styles . flexRow , styles . pv2 , styles . pr4 , StyleUtils . getPaddingLeft ( variables . w12 ) ] } >
672678 < Checkbox
673679 onPress = { ( ) => {
674680 if ( selectedTransactionIDs . length !== 0 ) {
@@ -680,10 +686,8 @@ function MoneyRequestReportTransactionList({
680686 accessibilityLabel = { translate ( 'accessibilityHints.selectAllTransactions' ) }
681687 isIndeterminate = { selectedTransactionIDs . length > 0 && selectedTransactionIDs . length !== transactionsWithoutPendingDelete . length }
682688 isChecked = { selectedTransactionIDs . length > 0 && selectedTransactionIDs . length === transactionsWithoutPendingDelete . length }
683- containerStyle = { isDesktopTableLayout && styles . m0 }
684- style = { isDesktopTableLayout && styles . mr3 }
685689 />
686- { isMediumScreenWidth && ! shouldScrollHorizontally && < Text style = { [ styles . labelStrong ] } > { translate ( 'workspace.people.selectAll' ) } </ Text > }
690+ { isMediumScreenWidth && ! shouldScrollHorizontally && < Text style = { [ styles . textStrong , styles . ph3 ] } > { translate ( 'workspace.people.selectAll' ) } </ Text > }
687691 </ View >
688692 { ( ! isMediumScreenWidth || shouldScrollHorizontally ) && (
689693 < MoneyRequestReportTableHeader
@@ -694,7 +698,6 @@ function MoneyRequestReportTransactionList({
694698 dateColumnSize = { dateColumnSize }
695699 amountColumnSize = { amountColumnSize }
696700 taxAmountColumnSize = { taxAmountColumnSize }
697- shouldRemoveTotalColumnFlex
698701 onSortPress = { ( selectedSortBy , selectedSortOrder ) => {
699702 if ( ! isSortableColumnName ( selectedSortBy ) ) {
700703 return ;
0 commit comments