Skip to content

Commit 4101b76

Browse files
committed
fix more content display logic
1 parent bf868bc commit 4101b76

1 file changed

Lines changed: 36 additions & 27 deletions

File tree

src/components/MoneyReportHeader.tsx

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ function MoneyReportHeader({
422422
};
423423

424424
const statusBarProps = getStatusBarProps();
425-
const shouldAddGapToContents = shouldUseNarrowLayout && shouldShowSelectedTransactionsButton && (!!statusBarProps || shouldShowNextStep);
426425

427426
useEffect(() => {
428427
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
@@ -879,8 +878,6 @@ function MoneyReportHeader({
879878

880879
const shouldShowBackButton = shouldDisplayBackButton || shouldUseNarrowLayout;
881880

882-
const isMoreContentShown = shouldShowNextStep || !!statusBarProps;
883-
884881
const connectedIntegrationName = connectedIntegration ? translate('workspace.accounting.connectionName', {connectionName: connectedIntegration}) : '';
885882
const unapproveWarningText = useMemo(
886883
() => (
@@ -951,6 +948,41 @@ function MoneyReportHeader({
951948
</KYCWall>
952949
);
953950

951+
const moreContentUnfiltered = [
952+
shouldShowSelectedTransactionsButton && shouldDisplayNarrowVersion && (
953+
<View
954+
style={[styles.dFlex, styles.w100, styles.pb3]}
955+
key="1"
956+
>
957+
<ButtonWithDropdownMenu
958+
onPress={() => null}
959+
options={selectedTransactionsOptions}
960+
customText={translate('workspace.common.selected', {count: selectedTransactionIDs.length})}
961+
isSplitButton={false}
962+
shouldAlwaysShowDropdownMenu
963+
wrapperStyle={styles.w100}
964+
/>
965+
</View>
966+
),
967+
shouldShowNextStep && !!optimisticNextStep?.message?.length && (
968+
<MoneyReportHeaderStatusBar
969+
nextStep={optimisticNextStep}
970+
key="2"
971+
/>
972+
),
973+
shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline && <MoneyReportHeaderStatusBarSkeleton key="3" />,
974+
!!statusBarProps && (
975+
<MoneyRequestHeaderStatusBar
976+
icon={statusBarProps.icon}
977+
description={statusBarProps.description}
978+
key="4"
979+
/>
980+
),
981+
];
982+
const moreContent = moreContentUnfiltered.filter(Boolean);
983+
const isMoreContentShown = moreContent.length > 0;
984+
const shouldAddGapToContents = moreContent.length > 1;
985+
954986
return (
955987
<View style={[styles.pt0, styles.borderBottom]}>
956988
<HeaderWithBackButton
@@ -989,30 +1021,7 @@ function MoneyReportHeader({
9891021
{!!applicableSecondaryActions.length && KYCMoreDropdown}
9901022
</View>
9911023
)}
992-
{isMoreContentShown && (
993-
<View style={[styles.dFlex, styles.flexColumn, shouldAddGapToContents && styles.gap3, styles.pb3, styles.ph5]}>
994-
{shouldShowSelectedTransactionsButton && shouldDisplayNarrowVersion && (
995-
<View style={[styles.dFlex, styles.w100, styles.pb3]}>
996-
<ButtonWithDropdownMenu
997-
onPress={() => null}
998-
options={selectedTransactionsOptions}
999-
customText={translate('workspace.common.selected', {count: selectedTransactionIDs.length})}
1000-
isSplitButton={false}
1001-
shouldAlwaysShowDropdownMenu
1002-
wrapperStyle={styles.w100}
1003-
/>
1004-
</View>
1005-
)}
1006-
{shouldShowNextStep && !!optimisticNextStep?.message?.length && <MoneyReportHeaderStatusBar nextStep={optimisticNextStep} />}
1007-
{shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline && <MoneyReportHeaderStatusBarSkeleton />}
1008-
{!!statusBarProps && (
1009-
<MoneyRequestHeaderStatusBar
1010-
icon={statusBarProps.icon}
1011-
description={statusBarProps.description}
1012-
/>
1013-
)}
1014-
</View>
1015-
)}
1024+
{isMoreContentShown && <View style={[styles.dFlex, styles.flexColumn, shouldAddGapToContents && styles.gap3, styles.pb3, styles.ph5]}>{moreContent}</View>}
10161025
<LoadingBar shouldShow={shouldShowLoadingBar && shouldUseNarrowLayout} />
10171026
{isHoldMenuVisible && requestType !== undefined && (
10181027
<ProcessMoneyReportHoldMenu

0 commit comments

Comments
 (0)