Skip to content
Merged
Changes from all commits
Commits
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
63 changes: 36 additions & 27 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -870,8 +869,6 @@ function MoneyReportHeader({

const shouldShowBackButton = shouldDisplayBackButton || shouldUseNarrowLayout;

const isMoreContentShown = shouldShowNextStep || !!statusBarProps;

const connectedIntegrationName = connectedIntegration ? translate('workspace.accounting.connectionName', {connectionName: connectedIntegration}) : '';
const unapproveWarningText = useMemo(
() => (
Expand Down Expand Up @@ -942,6 +939,41 @@ function MoneyReportHeader({
</KYCWall>
);

const moreContentUnfiltered = [
shouldShowSelectedTransactionsButton && shouldDisplayNarrowVersion && (
<View
style={[styles.dFlex, styles.w100, styles.pb3]}
key="1"
>
<ButtonWithDropdownMenu
onPress={() => null}
options={selectedTransactionsOptions}
customText={translate('workspace.common.selected', {count: selectedTransactionIDs.length})}
isSplitButton={false}
shouldAlwaysShowDropdownMenu
wrapperStyle={styles.w100}
/>
</View>
),
shouldShowNextStep && !!optimisticNextStep?.message?.length && (
<MoneyReportHeaderStatusBar
nextStep={optimisticNextStep}
key="2"
/>
),
shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline && <MoneyReportHeaderStatusBarSkeleton key="3" />,
!!statusBarProps && (
<MoneyRequestHeaderStatusBar
icon={statusBarProps.icon}
description={statusBarProps.description}
key="4"
/>
),
];
const moreContent = moreContentUnfiltered.filter(Boolean);
const isMoreContentShown = moreContent.length > 0;
const shouldAddGapToContents = moreContent.length > 1;

return (
<View style={[styles.pt0, styles.borderBottom]}>
<HeaderWithBackButton
Expand Down Expand Up @@ -980,30 +1012,7 @@ function MoneyReportHeader({
{!!applicableSecondaryActions.length && KYCMoreDropdown}
</View>
)}
{isMoreContentShown && (
<View style={[styles.dFlex, styles.flexColumn, shouldAddGapToContents && styles.gap3, styles.pb3, styles.ph5]}>
{shouldShowSelectedTransactionsButton && shouldDisplayNarrowVersion && (
<View style={[styles.dFlex, styles.w100, styles.pb3]}>
<ButtonWithDropdownMenu
onPress={() => null}
options={selectedTransactionsOptions}
customText={translate('workspace.common.selected', {count: selectedTransactionIDs.length})}
isSplitButton={false}
shouldAlwaysShowDropdownMenu
wrapperStyle={styles.w100}
/>
</View>
)}
{shouldShowNextStep && !!optimisticNextStep?.message?.length && <MoneyReportHeaderStatusBar nextStep={optimisticNextStep} />}
{shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline && <MoneyReportHeaderStatusBarSkeleton />}
{!!statusBarProps && (
<MoneyRequestHeaderStatusBar
icon={statusBarProps.icon}
description={statusBarProps.description}
/>
)}
</View>
)}
{isMoreContentShown && <View style={[styles.dFlex, styles.flexColumn, shouldAddGapToContents && styles.gap3, styles.pb3, styles.ph5]}>{moreContent}</View>}
<LoadingBar shouldShow={shouldShowLoadingBar && shouldUseNarrowLayout} />
{isHoldMenuVisible && requestType !== undefined && (
<ProcessMoneyReportHoldMenu
Expand Down
Loading