Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: There's a lot of extra space above the report actions #38449

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
fd919af
Fix: There's a lot of extra space above the report actions
rayane-djouah Mar 17, 2024
7cc5415
Fix: There's a lot of extra space above the report actions
rayane-djouah Mar 17, 2024
008e993
Fix lint errors
rayane-djouah Mar 17, 2024
7be7a46
Fix failing test
rayane-djouah Mar 17, 2024
9484d6d
fix: list not scrollable
rayane-djouah Mar 17, 2024
7a81e69
remove unnecessary View
rayane-djouah Mar 19, 2024
ca9dc94
Merge branch 'Expensify:main' into Fix--There's-a-lot-of-extra-space-…
rayane-djouah Mar 19, 2024
e247fb1
Display the pointer cursor when hovering over any part of the message
rayane-djouah Mar 21, 2024
fa02255
merge main and adress review comments
rayane-djouah Mar 21, 2024
f7f3a90
fix lint errors
rayane-djouah Mar 21, 2024
6a0fc4c
address review comments
rayane-djouah Mar 21, 2024
17065b5
Fix MoneyRequestView layout
rayane-djouah Mar 21, 2024
1315a08
Merge branch 'Expensify:main' into Fix--There's-a-lot-of-extra-space-…
rayane-djouah Mar 21, 2024
62eb107
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah Mar 23, 2024
74f8907
make the background image overlap scroll with the content, so that at…
rayane-djouah Mar 26, 2024
78035ec
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah Mar 26, 2024
376c7b2
add missing isOverlapBackgroundImage and fix lint errors
rayane-djouah Mar 26, 2024
59fd1f4
prettier
rayane-djouah Mar 26, 2024
a71aecd
fix native and mweb style
rayane-djouah Mar 26, 2024
210c5ee
fix lint error
rayane-djouah Mar 26, 2024
177fde9
prettier
rayane-djouah Mar 26, 2024
b6e542e
Merge branch 'Expensify:main' into Fix--There's-a-lot-of-extra-space-…
rayane-djouah Mar 26, 2024
179a2cc
revert a change mad by error
rayane-djouah Mar 28, 2024
dec3dbf
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah Mar 31, 2024
cca7245
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah Apr 4, 2024
58ff868
correct the empty state image logic
rayane-djouah Apr 7, 2024
969564b
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah Apr 7, 2024
e9c59a5
Fix lint errors
rayane-djouah Apr 7, 2024
2c1b5eb
Fix lint error
rayane-djouah Apr 7, 2024
612eb11
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah Apr 9, 2024
5d24a4e
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah Apr 15, 2024
b229760
fix lint
rayane-djouah Apr 15, 2024
3d71266
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah Apr 25, 2024
82a20a3
use overflow hidden for the empty state image only on web and desktop
rayane-djouah Apr 26, 2024
3938918
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah Apr 30, 2024
a7caa10
Fix lint
rayane-djouah Apr 30, 2024
fdfedb9
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah May 3, 2024
a2fa88f
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah May 3, 2024
52e30c1
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah May 6, 2024
e350edd
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah May 8, 2024
bd8c802
fix lint errors
rayane-djouah May 8, 2024
c501c5a
fix lint error
rayane-djouah May 8, 2024
7f99e0c
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah May 12, 2024
77cd6de
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah May 13, 2024
ee89aa1
chore: Remove unnecessary positioning code
rayane-djouah May 13, 2024
10b8960
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah May 13, 2024
e0e7b7d
Merge branch 'main' into Fix--There's-a-lot-of-extra-space-above-the-…
rayane-djouah May 17, 2024
f6b4e71
Remove unnecessary style property
rayane-djouah May 17, 2024
dbcb442
add chatContentScrollViewPlatformStyles
rayane-djouah May 17, 2024
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
17 changes: 1 addition & 16 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,12 @@ const CONST = {
// Sizes needed for report empty state background image handling
EMPTY_STATE_BACKGROUND: {
ASPECT_RATIO: 3.72,
OVERLAP: 60,
SMALL_SCREEN: {
IMAGE_HEIGHT: 300,
CONTAINER_MINHEIGHT: 200,
VIEW_HEIGHT: 240,
},
WIDE_SCREEN: {
IMAGE_HEIGHT: 450,
CONTAINER_MINHEIGHT: 500,
VIEW_HEIGHT: 390,
},
MONEY_OR_TASK_REPORT: {
SMALL_SCREEN: {
IMAGE_HEIGHT: 300,
CONTAINER_MINHEIGHT: 280,
VIEW_HEIGHT: 240,
},
WIDE_SCREEN: {
IMAGE_HEIGHT: 450,
CONTAINER_MINHEIGHT: 280,
VIEW_HEIGHT: 390,
},
},
},

Expand Down
208 changes: 101 additions & 107 deletions src/components/ReportActionItem/MoneyReportView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import useLocalize from '@hooks/useLocalize';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import AnimatedEmptyStateBackground from '@pages/home/report/AnimatedEmptyStateBackground';
import variables from '@styles/variables';
import ROUTES from '@src/ROUTES';
import type {Policy, PolicyReportField, Report} from '@src/types/onyx';
Expand All @@ -41,7 +39,6 @@ function MoneyReportView({report, policy, policyReportFields, shouldShowHorizont
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {translate} = useLocalize();
const {isSmallScreenWidth} = useWindowDimensions();
const isSettled = ReportUtils.isSettled(report.reportID);
const isTotalUpdated = ReportUtils.hasUpdatedTotal(report);

Expand All @@ -65,115 +62,112 @@ function MoneyReportView({report, policy, policyReportFields, shouldShowHorizont
}, [policyReportFields, report]);

return (
<View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth, true)]}>
<AnimatedEmptyStateBackground />
<View style={[StyleUtils.getReportWelcomeTopMarginStyle(isSmallScreenWidth, true)]}>
{!ReportUtils.isClosedExpenseReportWithNoExpenses(report) && (
<>
{ReportUtils.reportFieldsEnabled(report) &&
sortedPolicyReportFields.map((reportField) => {
const isTitleField = ReportUtils.isReportFieldOfTypeTitle(reportField);
const fieldValue = isTitleField ? report.reportName : reportField.value ?? reportField.defaultValue;
const isFieldDisabled = ReportUtils.isReportFieldDisabled(report, reportField, policy);
<View>
{!ReportUtils.isClosedExpenseReportWithNoExpenses(report) && (
<>
{ReportUtils.reportFieldsEnabled(report) &&
sortedPolicyReportFields.map((reportField) => {
const isTitleField = ReportUtils.isReportFieldOfTypeTitle(reportField);
const fieldValue = isTitleField ? report.reportName : reportField.value ?? reportField.defaultValue;
const isFieldDisabled = ReportUtils.isReportFieldDisabled(report, reportField, policy);

return (
<OfflineWithFeedback
pendingAction={report.pendingFields?.[reportField.fieldID]}
errors={report.errorFields?.[reportField.fieldID]}
errorRowStyles={styles.ph5}
key={`menuItem-${reportField.fieldID}`}
>
<MenuItemWithTopDescription
description={Str.UCFirst(reportField.name)}
title={fieldValue}
onPress={() => Navigation.navigate(ROUTES.EDIT_REPORT_FIELD_REQUEST.getRoute(report.reportID, report.policyID ?? '', reportField.fieldID))}
shouldShowRightIcon
disabled={isFieldDisabled}
wrapperStyle={[styles.pv2, styles.taskDescriptionMenuItem]}
shouldGreyOutWhenDisabled={false}
numberOfLinesTitle={0}
interactive
shouldStackHorizontally={false}
onSecondaryInteraction={() => {}}
hoverAndPressStyle={false}
titleWithTooltips={[]}
/>
</OfflineWithFeedback>
);
})}
<View style={[styles.flexRow, styles.pointerEventsNone, styles.containerWithSpaceBetween, styles.ph5, styles.pv2]}>
<View style={[styles.flex1, styles.justifyContentCenter]}>
<Text
style={[styles.textLabelSupporting]}
numberOfLines={1}
>
{translate('common.total')}
</Text>
</View>
<View style={[styles.flexRow, styles.justifyContentCenter]}>
{isSettled && (
<View style={[styles.defaultCheckmarkWrapper, styles.mh2]}>
<Icon
src={Expensicons.Checkmark}
fill={theme.success}
/>
</View>
)}
<Text
numberOfLines={1}
style={[styles.taskTitleMenuItem, styles.alignSelfCenter, !isTotalUpdated && styles.offlineFeedback.pending]}
return (
<OfflineWithFeedback
pendingAction={report.pendingFields?.[reportField.fieldID]}
errors={report.errorFields?.[reportField.fieldID]}
errorRowStyles={styles.ph5}
key={`menuItem-${reportField.fieldID}`}
>
{formattedTotalAmount}
</Text>
</View>
<MenuItemWithTopDescription
description={Str.UCFirst(reportField.name)}
title={fieldValue}
onPress={() => Navigation.navigate(ROUTES.EDIT_REPORT_FIELD_REQUEST.getRoute(report.reportID, report.policyID ?? '', reportField.fieldID))}
shouldShowRightIcon
disabled={isFieldDisabled}
wrapperStyle={[styles.pv2, styles.taskDescriptionMenuItem]}
shouldGreyOutWhenDisabled={false}
numberOfLinesTitle={0}
interactive
shouldStackHorizontally={false}
onSecondaryInteraction={() => {}}
hoverAndPressStyle={false}
titleWithTooltips={[]}
/>
</OfflineWithFeedback>
);
})}
<View style={[styles.flexRow, styles.pointerEventsNone, styles.containerWithSpaceBetween, styles.ph5, styles.pv2]}>
<View style={[styles.flex1, styles.justifyContentCenter]}>
<Text
style={[styles.textLabelSupporting]}
numberOfLines={1}
>
{translate('common.total')}
</Text>
</View>
{Boolean(shouldShowBreakdown) && (
<>
<View style={[styles.flexRow, styles.pointerEventsNone, styles.containerWithSpaceBetween, styles.ph5, styles.pv1]}>
<View style={[styles.flex1, styles.justifyContentCenter]}>
<Text
style={[styles.textLabelSupporting]}
numberOfLines={1}
>
{translate('cardTransactions.outOfPocket')}
</Text>
</View>
<View style={[styles.flexRow, styles.justifyContentCenter]}>
<Text
numberOfLines={1}
style={subAmountTextStyles}
>
{formattedOutOfPocketAmount}
</Text>
</View>
<View style={[styles.flexRow, styles.justifyContentCenter]}>
{isSettled && (
<View style={[styles.defaultCheckmarkWrapper, styles.mh2]}>
<Icon
src={Expensicons.Checkmark}
fill={theme.success}
/>
</View>
)}
<Text
numberOfLines={1}
style={[styles.taskTitleMenuItem, styles.alignSelfCenter, !isTotalUpdated && styles.offlineFeedback.pending]}
>
{formattedTotalAmount}
</Text>
</View>
</View>
{Boolean(shouldShowBreakdown) && (
<>
<View style={[styles.flexRow, styles.pointerEventsNone, styles.containerWithSpaceBetween, styles.ph5, styles.pv1]}>
<View style={[styles.flex1, styles.justifyContentCenter]}>
<Text
style={[styles.textLabelSupporting]}
numberOfLines={1}
>
{translate('cardTransactions.outOfPocket')}
</Text>
</View>
<View style={[styles.flexRow, styles.pointerEventsNone, styles.containerWithSpaceBetween, styles.ph5, styles.pv1]}>
<View style={[styles.flex1, styles.justifyContentCenter]}>
<Text
style={[styles.textLabelSupporting]}
numberOfLines={1}
>
{translate('cardTransactions.companySpend')}
</Text>
</View>
<View style={[styles.flexRow, styles.justifyContentCenter]}>
<Text
numberOfLines={1}
style={subAmountTextStyles}
>
{formattedCompanySpendAmount}
</Text>
</View>
<View style={[styles.flexRow, styles.justifyContentCenter]}>
<Text
numberOfLines={1}
style={subAmountTextStyles}
>
{formattedOutOfPocketAmount}
</Text>
</View>
</View>
<View style={[styles.flexRow, styles.pointerEventsNone, styles.containerWithSpaceBetween, styles.ph5, styles.pv1]}>
<View style={[styles.flex1, styles.justifyContentCenter]}>
<Text
style={[styles.textLabelSupporting]}
numberOfLines={1}
>
{translate('cardTransactions.companySpend')}
</Text>
</View>
</>
)}
<SpacerView
shouldShow={shouldShowHorizontalRule}
style={[shouldShowHorizontalRule && styles.reportHorizontalRule]}
/>
</>
)}
</View>
<View style={[styles.flexRow, styles.justifyContentCenter]}>
<Text
numberOfLines={1}
style={subAmountTextStyles}
>
{formattedCompanySpendAmount}
</Text>
</View>
</View>
</>
)}
<SpacerView
shouldShow={shouldShowHorizontalRule}
style={[shouldShowHorizontalRule && styles.reportHorizontalRule]}
/>
</>
)}
</View>
);
}
Expand Down
10 changes: 2 additions & 8 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ import Text from '@components/Text';
import ViolationMessages from '@components/ViolationMessages';
import useLocalize from '@hooks/useLocalize';
import usePermissions from '@hooks/usePermissions';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useViolations from '@hooks/useViolations';
import type {ViolationField} from '@hooks/useViolations';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as CardUtils from '@libs/CardUtils';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import * as OptionsListUtils from '@libs/OptionsListUtils';
Expand All @@ -28,7 +26,6 @@ import * as ReportUtils from '@libs/ReportUtils';
import * as TransactionUtils from '@libs/TransactionUtils';
import ViolationsUtils from '@libs/Violations/ViolationsUtils';
import Navigation from '@navigation/Navigation';
import AnimatedEmptyStateBackground from '@pages/home/report/AnimatedEmptyStateBackground';
import * as IOU from '@userActions/IOU';
import * as Transaction from '@userActions/Transaction';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -87,8 +84,6 @@ function MoneyRequestView({
}: MoneyRequestViewProps) {
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {isSmallScreenWidth} = useWindowDimensions();
const {translate} = useLocalize();
const {canUseViolations} = usePermissions();
const parentReportAction = parentReportActions?.[report.parentReportActionID ?? ''] ?? null;
Expand Down Expand Up @@ -237,9 +232,8 @@ function MoneyRequestView({
);

return (
<View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth)]}>
<AnimatedEmptyStateBackground />
<View style={[StyleUtils.getReportWelcomeTopMarginStyle(isSmallScreenWidth)]}>
<View>
<View>
{/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */}
{(showMapAsImage || hasReceipt) && (
<OfflineWithFeedback
Expand Down
Loading
Loading