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: change styles for the requestee #25952

Merged
Merged
Changes from 1 commit
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
10 changes: 6 additions & 4 deletions src/components/ReportActionItem/MoneyRequestView.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans

const isDistanceRequest = TransactionUtils.isDistanceRequest(transaction);

const isInteractive = canEdit && !isSettled;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is redundant I think. If canEdit, !isSettled already

App/src/libs/ReportUtils.js

Lines 1264 to 1267 in 643e2e8

const isReportSettled = isSettled(moneyRequestReport.reportID);
const isAdmin = isExpenseReport(moneyRequestReport) && lodashGet(getPolicy(moneyRequestReport.policyID), 'role', '') === CONST.POLICY.ROLE.ADMIN;
const isRequestor = currentUserAccountID === reportAction.actorAccountID;
return !isReportSettled && (isAdmin || isRequestor);


return (
<View>
<View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth), StyleUtils.getMinimumHeight(CONST.EMPTY_STATE_BACKGROUND.MONEY_REPORT.MIN_HEIGHT)]}>
Expand All @@ -117,7 +119,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans
titleIcon={Expensicons.Checkmark}
description={description}
titleStyle={styles.newKansasLarge}
disabled={isSettled || !canEdit}
interactive={isInteractive}
shouldShowRightIcon={canEdit}
onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.AMOUNT))}
/>
Expand All @@ -126,7 +128,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans
<MenuItemWithTopDescription
description={translate('common.description')}
title={transactionDescription}
disabled={isSettled || !canEdit}
interactive={isInteractive}
shouldShowRightIcon={canEdit}
titleStyle={styles.flex1}
onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DESCRIPTION))}
Expand All @@ -136,7 +138,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans
<MenuItemWithTopDescription
description={translate('common.date')}
title={transactionDate}
disabled={isSettled || !canEdit}
interactive={isInteractive}
shouldShowRightIcon={canEdit}
titleStyle={styles.flex1}
onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DATE))}
Expand All @@ -146,7 +148,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans
<MenuItemWithTopDescription
description={isDistanceRequest ? translate('tabSelector.distance') : translate('common.merchant')}
title={transactionMerchant}
disabled={isSettled || !canEdit}
interactive={isInteractive}
shouldShowRightIcon={canEdit}
titleStyle={styles.flex1}
onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.MERCHANT))}
Expand Down