Skip to content

Commit 8176ab1

Browse files
author
lukaw3d
committed
Move tokens above contracts in search results
1 parent a22e396 commit 8176ab1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/app/pages/SearchResultsPage/SearchResultsList.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ export const SearchResultsList: FC<{
105105
linkLabel={t('search.results.transactions.viewLink')}
106106
/>
107107

108+
<ResultsGroupByType
109+
title={t('search.results.tokens.title')}
110+
results={searchResults.filter((item): item is TokenResult => item.resultType === 'token')}
111+
resultComponent={item => <TokenDetails token={item} highlightedPartOfName={searchTerm} showLayer />}
112+
link={token => RouteUtils.getTokenRoute(token, token.eth_contract_addr ?? token.contract_addr)}
113+
linkLabel={t('search.results.tokens.viewLink')}
114+
/>
115+
108116
<ResultsGroupByType
109117
title={t('search.results.accounts.title')}
110118
results={searchResults.filter((item): item is AccountResult => item.resultType === 'account')}
@@ -159,14 +167,6 @@ export const SearchResultsList: FC<{
159167
linkLabel={t('search.results.roflApps.viewLink')}
160168
/>
161169

162-
<ResultsGroupByType
163-
title={t('search.results.tokens.title')}
164-
results={searchResults.filter((item): item is TokenResult => item.resultType === 'token')}
165-
resultComponent={item => <TokenDetails token={item} highlightedPartOfName={searchTerm} showLayer />}
166-
link={token => RouteUtils.getTokenRoute(token, token.eth_contract_addr ?? token.contract_addr)}
167-
linkLabel={t('search.results.tokens.viewLink')}
168-
/>
169-
170170
<ResultsGroupByType
171171
title={t('search.results.proposals.title')}
172172
results={searchResults.filter((item): item is ProposalResult => item.resultType === 'proposal')}

src/app/pages/SearchResultsPage/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ export const useSearch = (currentScope: SearchScope | undefined, q: SearchParams
411411
: [
412412
...blocks.map((block): BlockResult => ({ ...block, resultType: 'block' })),
413413
...transactions.map((tx): TransactionResult => ({ ...tx, resultType: 'transaction' })),
414+
...tokens.map((token): TokenResult => ({ ...token, resultType: 'token' })),
414415
...accounts
415416
.filter(account => !(account as RuntimeAccount).evm_contract)
416417
.map((account): AccountResult => ({ ...account, resultType: 'account' })),
@@ -419,7 +420,6 @@ export const useSearch = (currentScope: SearchScope | undefined, q: SearchParams
419420
.filter(account => account.evm_contract)
420421
.map((account): ContractResult => ({ ...account, resultType: 'contract' })),
421422
...roflApps.map((roflApp): RoflAppResult => ({ ...roflApp, resultType: 'roflApp' })),
422-
...tokens.map((token): TokenResult => ({ ...token, resultType: 'token' })),
423423
...proposals.map((proposal): ProposalResult => ({ ...proposal, resultType: 'proposal' })),
424424
]
425425
return {

0 commit comments

Comments
 (0)