mirror of
https://github.com/mempool/mempool.git
synced 2025-02-23 14:40:38 +01:00
Search result: do not offer Go to block
This commit is contained in:
parent
14e440da6b
commit
b0c02b16ff
1 changed files with 5 additions and 3 deletions
|
@ -174,7 +174,7 @@ export class SearchFormComponent implements OnInit {
|
||||||
const addressPrefixSearchResults = result[0];
|
const addressPrefixSearchResults = result[0];
|
||||||
const lightningResults = result[1];
|
const lightningResults = result[1];
|
||||||
|
|
||||||
const matchesBlockHeight = this.regexBlockheight.test(searchText);
|
const matchesBlockHeight = this.regexBlockheight.test(searchText) && parseInt(searchText) <= this.stateService.latestBlockHeight;
|
||||||
const matchesDateTime = this.regexDate.test(searchText) && new Date(searchText).toString() !== 'Invalid Date';
|
const matchesDateTime = this.regexDate.test(searchText) && new Date(searchText).toString() !== 'Invalid Date';
|
||||||
const matchesUnixTimestamp = this.regexUnixTimestamp.test(searchText);
|
const matchesUnixTimestamp = this.regexUnixTimestamp.test(searchText);
|
||||||
const matchesTxId = this.regexTransaction.test(searchText) && !this.regexBlockhash.test(searchText);
|
const matchesTxId = this.regexTransaction.test(searchText) && !this.regexBlockhash.test(searchText);
|
||||||
|
@ -217,7 +217,7 @@ export class SearchFormComponent implements OnInit {
|
||||||
selectedResult(result: any): void {
|
selectedResult(result: any): void {
|
||||||
if (typeof result === 'string') {
|
if (typeof result === 'string') {
|
||||||
this.search(result);
|
this.search(result);
|
||||||
} else if (typeof result === 'number') {
|
} else if (typeof result === 'number' && result <= this.stateService.latestBlockHeight) {
|
||||||
this.navigate('/block/', result.toString());
|
this.navigate('/block/', result.toString());
|
||||||
} else if (result.alias) {
|
} else if (result.alias) {
|
||||||
this.navigate('/lightning/node/', result.public_key);
|
this.navigate('/lightning/node/', result.public_key);
|
||||||
|
@ -232,8 +232,10 @@ export class SearchFormComponent implements OnInit {
|
||||||
this.isSearching = true;
|
this.isSearching = true;
|
||||||
if (!this.regexTransaction.test(searchText) && this.regexAddress.test(searchText)) {
|
if (!this.regexTransaction.test(searchText) && this.regexAddress.test(searchText)) {
|
||||||
this.navigate('/address/', searchText);
|
this.navigate('/address/', searchText);
|
||||||
} else if (this.regexBlockhash.test(searchText) || this.regexBlockheight.test(searchText)) {
|
} else if (this.regexBlockhash.test(searchText)) {
|
||||||
this.navigate('/block/', searchText);
|
this.navigate('/block/', searchText);
|
||||||
|
} else if (this.regexBlockheight.test(searchText)) {
|
||||||
|
parseInt(searchText) <= this.stateService.latestBlockHeight ? this.navigate('/block/', searchText) : this.isSearching = false;
|
||||||
} else if (this.regexTransaction.test(searchText)) {
|
} else if (this.regexTransaction.test(searchText)) {
|
||||||
const matches = this.regexTransaction.exec(searchText);
|
const matches = this.regexTransaction.exec(searchText);
|
||||||
if (this.network === 'liquid' || this.network === 'liquidtestnet') {
|
if (this.network === 'liquid' || this.network === 'liquidtestnet') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue