From 86b923d26db6b9c357f44cc25fa548b019b4ea8b Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Tue, 23 Jul 2024 15:47:44 +0200 Subject: [PATCH] fix: resolve comments --- src/libs/TransactionUtils.ts | 3 +- .../TransactionDuplicate/Confirmation.tsx | 72 +++++++++---------- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/src/libs/TransactionUtils.ts b/src/libs/TransactionUtils.ts index 3607d9920c45..9cb2989556ec 100644 --- a/src/libs/TransactionUtils.ts +++ b/src/libs/TransactionUtils.ts @@ -867,6 +867,7 @@ function compareDuplicateTransactionFields(transactionID: string): {keep: Partia reimbursable: ['reimbursable'], }; + // Helper function thats create an array of different values for a given key in the transactions function getDifferentValues(items: Array>, keys: Array) { return [ ...new Set( @@ -883,6 +884,7 @@ function compareDuplicateTransactionFields(transactionID: string): {keep: Partia ), ]; } + // Helper function to check if all comments are equal function areAllCommentsEqual(items: Array>, firstTransaction: OnyxEntry) { return items.every((item) => lodashIsEqual(item?.comment, firstTransaction?.comment)); @@ -907,7 +909,6 @@ function compareDuplicateTransactionFields(transactionID: string): {keep: Partia } } - // Main refactoring logic for (const fieldName in fieldsToCompare) { if (Object.prototype.hasOwnProperty.call(fieldsToCompare, fieldName)) { const keys = fieldsToCompare[fieldName]; diff --git a/src/pages/TransactionDuplicate/Confirmation.tsx b/src/pages/TransactionDuplicate/Confirmation.tsx index 9499c24efce7..e5c4b8855d90 100644 --- a/src/pages/TransactionDuplicate/Confirmation.tsx +++ b/src/pages/TransactionDuplicate/Confirmation.tsx @@ -8,14 +8,12 @@ import Button from '@components/Button'; import FixedFooter from '@components/FixedFooter'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import MoneyRequestView from '@components/ReportActionItem/MoneyRequestView'; -import SafeAreaConsumer from '@components/SafeAreaConsumer'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import {ShowContextMenuContext} from '@components/ShowContextMenuContext'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import useWindowDimensions from '@hooks/useWindowDimensions'; import Navigation from '@libs/Navigation/Navigation'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import variables from '@styles/variables'; @@ -38,7 +36,6 @@ function Confirmation() { const reportAction = Object.values(reportActions ?? {}).find( (action) => ReportActionsUtils.isMoneyRequestAction(action) && ReportActionsUtils.getOriginalMessage(action)?.IOUTransactionID === reviewDuplicates?.transactionID, ); - const {isExtraSmallScreenHeight} = useWindowDimensions(); const transactionsMergeParams = useMemo(() => TransactionUtils.buildTransactionsMergeParams(reviewDuplicates, transaction), [reviewDuplicates, transaction]); const mergeDuplicates = useCallback(() => { @@ -63,43 +60,40 @@ function Confirmation() { testID={Confirmation.displayName} shouldShowOfflineIndicator > - - {({safeAreaPaddingBottomStyle}) => ( - - - - - - {translate('violations.confirmDetails')} - - {translate('violations.confirmDuplicatesInfo')} - - {/* We need that provider here becuase MoneyRequestView component requires that */} - - } - /> - - - -