diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b5b71f816..3aec245318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ - [#3224](https://github.com/poanetwork/blockscout/pull/3224) - Top tokens page ### Fixes +- [#3231](https://github.com/poanetwork/blockscout/pull/3231) - Improve search: unlimited number of searching results +- [#3231](https://github.com/poanetwork/blockscout/pull/3231) - Improve search: allow search with space +- [#3231](https://github.com/poanetwork/blockscout/pull/3231) - Improve search: order by token holders in descending order and token/contract name is ascending order - [#3226](https://github.com/poanetwork/blockscout/pull/3226) - Fix notifier query for live update of token transfers - [#3220](https://github.com/poanetwork/blockscout/pull/3220) - Allow interaction with navbar menu at block-not-found page diff --git a/apps/block_scout_web/assets/css/components/_navbar.scss b/apps/block_scout_web/assets/css/components/_navbar.scss index 05ab0f109d..e22a3ee82c 100644 --- a/apps/block_scout_web/assets/css/components/_navbar.scss +++ b/apps/block_scout_web/assets/css/components/_navbar.scss @@ -186,6 +186,14 @@ $navbar-logo-width: auto !default; } } +.input-group { + + .awesomplete > ul { + overflow-y: auto !important; + max-height: 300px !important; + } +} + .navbar-collapse.collapsing, .navbar-collapse.collapse.show { display: flex; diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex index 7698f84521..4d0ef2d6c9 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex @@ -167,18 +167,32 @@ <%= awesomplete(f, :q, [ class: "form-control me auto", - placeholder: gettext("Search by address, token symbol name, transaction hash, or block number"), + placeholder: gettext("Search by address, token symbol, name, transaction hash, or block number"), "aria-describedby": "search-icon", "aria-label": gettext("Search"), "data-test": "search_input" ], [ url: "#{chain_path(@conn, :token_autocomplete)}?q=", limit: 0, + maxItems: 1000, minChars: 2, value: "contract_address_hash", label: "contract_address_hash", descrSearch: true, - descr: "symbol" + descr: "name", + sort: "function(x1, x2){ + const tokenName1 = x1.split('').length > 1 ? x1.split('')[1].split('')[0].toLowerCase() : '' + const tokenName2 = x2.split('').length > 1 ? x2.split('')[1].split('')[0].toLowerCase() : '' + const holdersCount1 = x1.split('').length > 1 ? parseInt(x1.split('')[1].split('')[0].split('holder')[0], 10) : null + const holdersCount2 = x2.split('').length > 1 ? parseInt(x2.split('')[1].split('')[0].split('holder')[0], 10) : null + if (holdersCount1 && holdersCount2 && holdersCount1 !== holdersCount2 || (holdersCount1 && !holdersCount2) || (!holdersCount1 && holdersCount2)) { + holdersCount1 > holdersCount2 + } else { + if (tokenName1 < tokenName2) { return -1 } + if (tokenName1 > tokenName2) { return 1 } + return 0 + } + }" ]) %>