Skip to content

Commit 539e683

Browse files
committed
rm types
1 parent d9f339a commit 539e683

File tree

5 files changed

+16
-48
lines changed

5 files changed

+16
-48
lines changed

src/components/SelectionList/Search/ExpenseItemHeaderNarrow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import useTheme from '@hooks/useTheme';
99
import useThemeStyles from '@hooks/useThemeStyles';
1010
import variables from '@styles/variables';
1111
import CONST from '@src/CONST';
12-
import type {SearchAccountDetails, SearchTransactionAction} from '@src/types/onyx/SearchResults';
12+
import type {SearchPersonalDetails, SearchTransactionAction} from '@src/types/onyx/SearchResults';
1313
import ActionCell from './ActionCell';
1414
import UserInfoCell from './UserInfoCell';
1515

1616
type ExpenseItemHeaderNarrowProps = {
1717
text?: string;
18-
participantFrom: SearchAccountDetails;
19-
participantTo: SearchAccountDetails;
18+
participantFrom: SearchPersonalDetails;
19+
participantTo: SearchPersonalDetails;
2020
participantFromDisplayName: string;
2121
participantToDisplayName: string;
2222
action?: SearchTransactionAction;

src/components/SelectionList/Search/UserInfoCell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import Text from '@components/Text';
55
import useThemeStyles from '@hooks/useThemeStyles';
66
import useWindowDimensions from '@hooks/useWindowDimensions';
77
import CONST from '@src/CONST';
8-
import type {SearchAccountDetails} from '@src/types/onyx/SearchResults';
8+
import type {SearchPersonalDetails} from '@src/types/onyx/SearchResults';
99

1010
type UserInfoCellProps = {
11-
participant: SearchAccountDetails;
11+
participant: SearchPersonalDetails;
1212
displayName: string;
1313
};
1414

src/components/SelectionList/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {BrickRoad} from '@libs/WorkspacesSettingsUtils';
55
import type CursorStyles from '@styles/utils/cursor/types';
66
import type CONST from '@src/CONST';
77
import type {Errors, Icon, PendingAction} from '@src/types/onyx/OnyxCommon';
8-
import type {SearchAccountDetails, SearchReport, SearchTransaction} from '@src/types/onyx/SearchResults';
8+
import type {SearchPersonalDetails, SearchReport, SearchTransaction} from '@src/types/onyx/SearchResults';
99
import type {ReceiptErrors} from '@src/types/onyx/Transaction';
1010
import type ChildrenProps from '@src/types/utils/ChildrenProps';
1111
import type IconAsset from '@src/types/utils/IconAsset';
@@ -156,10 +156,10 @@ type ListItem = {
156156
type TransactionListItemType = ListItem &
157157
SearchTransaction & {
158158
/** The personal details of the user requesting money */
159-
from: SearchAccountDetails;
159+
from: SearchPersonalDetails;
160160

161161
/** The personal details of the user paying the request */
162-
to: SearchAccountDetails;
162+
to: SearchPersonalDetails;
163163

164164
/** final and formatted "from" value used for displaying and sorting */
165165
formattedFrom: string;
@@ -200,10 +200,10 @@ type TransactionListItemType = ListItem &
200200
type ReportListItemType = ListItem &
201201
SearchReport & {
202202
/** The personal details of the user requesting money */
203-
from: SearchAccountDetails;
203+
from: SearchPersonalDetails;
204204

205205
/** The personal details of the user paying the request */
206-
to: SearchAccountDetails;
206+
to: SearchPersonalDetails;
207207

208208
transactions: TransactionListItemType[];
209209
};

src/libs/SearchUtils.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {SearchAdvancedFiltersForm} from '@src/types/form';
1111
import FILTER_KEYS from '@src/types/form/SearchAdvancedFiltersForm';
1212
import type * as OnyxTypes from '@src/types/onyx';
1313
import type SearchResults from '@src/types/onyx/SearchResults';
14-
import type {ListItemDataType, ListItemType, SearchAccountDetails, SearchDataTypes, SearchPersonalDetails, SearchTransaction} from '@src/types/onyx/SearchResults';
14+
import type {ListItemDataType, ListItemType, SearchDataTypes, SearchPersonalDetails, SearchTransaction} from '@src/types/onyx/SearchResults';
1515
import DateUtils from './DateUtils';
1616
import navigationRef from './Navigation/navigationRef';
1717
import type {AuthScreensParamList, BottomTabNavigatorParamList, RootStackParamList, State} from './Navigation/types';
@@ -54,12 +54,12 @@ const operatorToSignMap = {
5454
function getTransactionItemCommonFormattedProperties(
5555
transactionItem: SearchTransaction,
5656
from: SearchPersonalDetails,
57-
to: SearchAccountDetails,
57+
to: SearchPersonalDetails,
5858
): Pick<TransactionListItemType, 'formattedFrom' | 'formattedTo' | 'formattedTotal' | 'formattedMerchant' | 'date'> {
5959
const isExpenseReport = transactionItem.reportType === CONST.REPORT.TYPE.EXPENSE;
6060

6161
const formattedFrom = from?.displayName ?? from?.login ?? '';
62-
const formattedTo = to?.name ?? to?.displayName ?? to?.login ?? '';
62+
const formattedTo = to?.displayName ?? to?.login ?? '';
6363
const formattedTotal = TransactionUtils.getAmount(transactionItem, isExpenseReport);
6464
const date = transactionItem?.modifiedCreated ? transactionItem.modifiedCreated : transactionItem?.created;
6565
const merchant = TransactionUtils.getMerchant(transactionItem);
@@ -181,17 +181,12 @@ function getReportSections(data: OnyxTypes.SearchResults['data'], metadata: Onyx
181181
const reportItem = {...data[key]};
182182
const reportKey = `${ONYXKEYS.COLLECTION.REPORT}${reportItem.reportID}`;
183183
const transactions = reportIDToTransactions[reportKey]?.transactions ?? [];
184-
const isExpenseReport = reportItem.type === CONST.REPORT.TYPE.EXPENSE;
185-
186-
const to = isExpenseReport
187-
? (data[`${ONYXKEYS.COLLECTION.POLICY}${reportItem.policyID}`] as SearchAccountDetails)
188-
: (data.personalDetailsList?.[reportItem.managerID] as SearchAccountDetails);
189184

190185
reportIDToTransactions[reportKey] = {
191186
...reportItem,
192187
keyForList: reportItem.reportID,
193188
from: data.personalDetailsList?.[reportItem.accountID],
194-
to,
189+
to: data.personalDetailsList?.[reportItem.managerID],
195190
transactions,
196191
};
197192
} else if (key.startsWith(ONYXKEYS.COLLECTION.TRANSACTION)) {

src/types/onyx/SearchResults.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,6 @@ type SearchPersonalDetails = {
6666
login?: string;
6767
};
6868

69-
/** Model of policy details search result */
70-
type SearchPolicyDetails = {
71-
/** ID of the policy */
72-
id: string;
73-
74-
/** Policy avatar URL */
75-
avatarURL: string;
76-
77-
/** Policy name */
78-
name: string;
79-
};
80-
8169
/** The action that can be performed for the transaction */
8270
type SearchTransactionAction = ValueOf<typeof CONST.SEARCH.ACTION_TYPES>;
8371

@@ -225,9 +213,6 @@ type SearchTransaction = {
225213
isFromOneTransactionReport?: boolean;
226214
};
227215

228-
/** Model of account details search result */
229-
type SearchAccountDetails = Partial<SearchPolicyDetails & SearchPersonalDetails>;
230-
231216
/** Types of searchable transactions */
232217
type SearchTransactionType = ValueOf<typeof CONST.SEARCH.TRANSACTION_TYPE>;
233218

@@ -237,24 +222,12 @@ type SearchResults = {
237222
search: SearchResultsInfo;
238223

239224
/** Search results data */
240-
data: Record<string, SearchTransaction & Record<string, SearchPersonalDetails>> & Record<string, SearchPolicyDetails> & Record<string, SearchReport>;
225+
data: Record<string, SearchTransaction & Record<string, SearchPersonalDetails>> & Record<string, SearchReport>;
241226

242227
/** Whether search data is being fetched from server */
243228
isLoading?: boolean;
244229
};
245230

246231
export default SearchResults;
247232

248-
export type {
249-
ListItemType,
250-
ListItemDataType,
251-
SearchTransaction,
252-
SearchTransactionType,
253-
SearchTransactionAction,
254-
SearchPersonalDetails,
255-
SearchPolicyDetails,
256-
SearchAccountDetails,
257-
SearchDataTypes,
258-
SearchReport,
259-
SectionsType,
260-
};
233+
export type {ListItemType, ListItemDataType, SearchTransaction, SearchTransactionType, SearchTransactionAction, SearchPersonalDetails, SearchDataTypes, SearchReport, SectionsType};

0 commit comments

Comments
 (0)