Skip to content

Commit 15742da

Browse files
author
Nabi
committed
refactor duplicate review selection layout
1 parent cc1ef92 commit 15742da

1 file changed

Lines changed: 41 additions & 30 deletions

File tree

src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import React from 'react';
2+
import {View} from 'react-native';
23
import type {OnyxEntry} from 'react-native-onyx';
34
import {getButtonRole} from '@components/Button/utils';
45
import OfflineWithFeedback from '@components/OfflineWithFeedback';
56
import {usePersonalDetails} from '@components/OnyxListItemProvider';
67
import {PressableWithFeedback} from '@components/Pressable';
8+
import RadioButton from '@components/RadioButton';
79
import type {ExpenseReportListItemType, TransactionListItemType} from '@components/Search/SearchList/ListItem/types';
810
import UserInfoAndActionButtonRow from '@components/Search/SearchList/ListItem/UserInfoAndActionButtonRow';
911
import TransactionItemRow from '@components/TransactionItemRow';
1012
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
1113
import useOnyx from '@hooks/useOnyx';
1214
import useThemeStyles from '@hooks/useThemeStyles';
1315
import {getOriginalMessage, isMoneyRequestAction} from '@libs/ReportActionsUtils';
14-
import variables from '@styles/variables';
1516
import {createTransactionThreadReport} from '@userActions/Report';
1617
import CONST from '@src/CONST';
1718
import ONYXKEYS from '@src/ONYXKEYS';
@@ -89,36 +90,46 @@ function DuplicateTransactionItem({transaction, isLastItem, isSelected, shouldSh
8990
role={getButtonRole(true)}
9091
isNested
9192
hoverStyle={styles.hoveredComponentBG}
92-
style={[!isLastItem && styles.borderBottom, styles.pt4, styles.pb4, styles.pl4, shouldShowSelection ? styles.pr0 : styles.pr4]}
93+
style={[!isLastItem && styles.borderBottom, styles.pt4, styles.pb4, styles.pl4, styles.pr4]}
9394
>
94-
{!!reportStatusItem && (
95-
<UserInfoAndActionButtonRow
96-
item={reportStatusItem}
97-
shouldShowUserInfo
98-
stateNum={report?.stateNum}
99-
statusNum={report?.statusNum}
100-
containerStyles={[styles.mb3, shouldShowSelection && styles.pr4]}
101-
/>
102-
)}
103-
<TransactionItemRow
104-
transactionItem={transaction as TransactionListItemType}
105-
report={report}
106-
policy={policy}
107-
shouldUseNarrowLayout
108-
isSelected={isSelected}
109-
shouldShowTooltip={false}
110-
dateColumnSize={CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
111-
amountColumnSize={CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
112-
taxAmountColumnSize={CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
113-
shouldHighlightItemWhenSelected={false}
114-
shouldShowErrors={false}
115-
style={shouldShowSelection ? [styles.pr0] : [styles.pv2]}
116-
shouldShowRadioButton={shouldShowSelection}
117-
shouldStopRadioButtonMouseDownPropagation
118-
radioButtonContainerStyle={styles.ml0}
119-
radioButtonWrapperStyle={[styles.justifyContentCenter, styles.pr3half, {paddingLeft: 10, height: variables.w44}]}
120-
onRadioButtonPress={() => onSelectTransaction(transaction.transactionID)}
121-
/>
95+
<View style={styles.flexRow}>
96+
<View style={[styles.flex1, shouldShowSelection && styles.mr3]}>
97+
{!!reportStatusItem && (
98+
<UserInfoAndActionButtonRow
99+
item={reportStatusItem}
100+
shouldShowUserInfo
101+
stateNum={report?.stateNum}
102+
statusNum={report?.statusNum}
103+
containerStyles={styles.mb3}
104+
/>
105+
)}
106+
<TransactionItemRow
107+
transactionItem={transaction as TransactionListItemType}
108+
report={report}
109+
policy={policy}
110+
shouldUseNarrowLayout
111+
isSelected={isSelected}
112+
shouldShowTooltip={false}
113+
dateColumnSize={CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
114+
amountColumnSize={CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
115+
taxAmountColumnSize={CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
116+
shouldHighlightItemWhenSelected={false}
117+
shouldShowErrors={false}
118+
style={!shouldShowSelection && styles.pv2}
119+
/>
120+
</View>
121+
{shouldShowSelection && (
122+
<View style={[styles.justifyContentCenter, styles.alignItemsCenter]}>
123+
<RadioButton
124+
isChecked={isSelected}
125+
onPress={() => onSelectTransaction(transaction.transactionID)}
126+
accessibilityLabel={CONST.ROLE.RADIO}
127+
shouldStopMouseDownPropagation
128+
style={[styles.justifyContentCenter, styles.alignItemsCenter]}
129+
/>
130+
</View>
131+
)}
132+
</View>
122133
</PressableWithFeedback>
123134
</OfflineWithFeedback>
124135
);

0 commit comments

Comments
 (0)