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

Polish: Dupe detection #45890

Merged
69 changes: 41 additions & 28 deletions src/pages/TransactionDuplicate/Confirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
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';
Expand All @@ -35,6 +38,7 @@ 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(() => {
Expand All @@ -59,34 +63,43 @@ function Confirmation() {
testID={Confirmation.displayName}
shouldShowOfflineIndicator
>
<HeaderWithBackButton title={translate('iou.reviewDuplicates')} />
<ScrollView style={styles.mb3}>
<View style={[styles.ph5, styles.pb8]}>
<Text
family="EXP_NEW_KANSAS_MEDIUM"
fontSize={variables.fontSizeLarge}
style={styles.pb5}
>
{translate('violations.confirmDetails')}
</Text>
<Text>{translate('violations.confirmDuplicatesInfo')}</Text>
</View>
{/* We need that provider here becuase MoneyRequestView component require that */}
<ShowContextMenuContext.Provider value={contextValue}>
<MoneyRequestView
report={report}
shouldShowAnimatedBackground={false}
readonly
updatedTransaction={transaction as OnyxEntry<Transaction>}
/>
</ShowContextMenuContext.Provider>
<Button
text={translate('common.confirm')}
success
style={[styles.ph5, styles.mt2]}
onPress={mergeDuplicates}
/>
</ScrollView>
<SafeAreaConsumer>
{({safeAreaPaddingBottomStyle}) => (
kubabutkiewicz marked this conversation as resolved.
Show resolved Hide resolved
<View style={[styles.flex1, safeAreaPaddingBottomStyle]}>
<HeaderWithBackButton title={translate('iou.reviewDuplicates')} />
<ScrollView>
<View style={[styles.ph5, styles.pb8]}>
<Text
family="EXP_NEW_KANSAS_MEDIUM"
fontSize={variables.fontSizeLarge}
style={styles.pb5}
>
{translate('violations.confirmDetails')}
</Text>
<Text>{translate('violations.confirmDuplicatesInfo')}</Text>
</View>
{/* We need that provider here becuase MoneyRequestView component require that */}
kubabutkiewicz marked this conversation as resolved.
Show resolved Hide resolved
<ShowContextMenuContext.Provider value={contextValue}>
<MoneyRequestView
report={report}
shouldShowAnimatedBackground={false}
readonly
updatedTransaction={transaction as OnyxEntry<Transaction>}
/>
</ShowContextMenuContext.Provider>
</ScrollView>
<FixedFooter style={styles.mtAuto}>
<Button
text={translate('common.confirm')}
success
onPress={mergeDuplicates}
medium={isExtraSmallScreenHeight}
large={!isExtraSmallScreenHeight}
kubabutkiewicz marked this conversation as resolved.
Show resolved Hide resolved
/>
</FixedFooter>
</View>
)}
</SafeAreaConsumer>
</ScreenWrapper>
);
}
Expand Down
Loading