From 4101b766f096365f203632b2070290471b84e7ca Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Wed, 9 Jul 2025 21:42:00 +0300 Subject: [PATCH] fix more content display logic --- src/components/MoneyReportHeader.tsx | 63 ++++++++++++++++------------ 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 6c500ad6fddbf..3fc8e92a19df3 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -422,7 +422,6 @@ function MoneyReportHeader({ }; const statusBarProps = getStatusBarProps(); - const shouldAddGapToContents = shouldUseNarrowLayout && shouldShowSelectedTransactionsButton && (!!statusBarProps || shouldShowNextStep); useEffect(() => { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing @@ -879,8 +878,6 @@ function MoneyReportHeader({ const shouldShowBackButton = shouldDisplayBackButton || shouldUseNarrowLayout; - const isMoreContentShown = shouldShowNextStep || !!statusBarProps; - const connectedIntegrationName = connectedIntegration ? translate('workspace.accounting.connectionName', {connectionName: connectedIntegration}) : ''; const unapproveWarningText = useMemo( () => ( @@ -951,6 +948,41 @@ function MoneyReportHeader({ ); + const moreContentUnfiltered = [ + shouldShowSelectedTransactionsButton && shouldDisplayNarrowVersion && ( + + null} + options={selectedTransactionsOptions} + customText={translate('workspace.common.selected', {count: selectedTransactionIDs.length})} + isSplitButton={false} + shouldAlwaysShowDropdownMenu + wrapperStyle={styles.w100} + /> + + ), + shouldShowNextStep && !!optimisticNextStep?.message?.length && ( + + ), + shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline && , + !!statusBarProps && ( + + ), + ]; + const moreContent = moreContentUnfiltered.filter(Boolean); + const isMoreContentShown = moreContent.length > 0; + const shouldAddGapToContents = moreContent.length > 1; + return ( )} - {isMoreContentShown && ( - - {shouldShowSelectedTransactionsButton && shouldDisplayNarrowVersion && ( - - null} - options={selectedTransactionsOptions} - customText={translate('workspace.common.selected', {count: selectedTransactionIDs.length})} - isSplitButton={false} - shouldAlwaysShowDropdownMenu - wrapperStyle={styles.w100} - /> - - )} - {shouldShowNextStep && !!optimisticNextStep?.message?.length && } - {shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline && } - {!!statusBarProps && ( - - )} - - )} + {isMoreContentShown && {moreContent}} {isHoldMenuVisible && requestType !== undefined && (