Merge pull request #2995 from mempool/simon/bisq-search-bar-fix

Bisq markets search bar fix
This commit is contained in:
wiz 2023-03-04 16:22:04 +09:00 committed by GitHub
commit 027603acf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,7 +107,13 @@ export class SearchFormComponent implements OnInit {
}))),
);
}),
tap((result: any[]) => {
map((result: any[]) => {
if (this.network === 'bisq') {
result[0] = result[0].map((address: string) => 'B' + address);
}
return result;
}),
tap(() => {
this.isTypeaheading$.next(false);
})
);
@ -126,7 +132,7 @@ export class SearchFormComponent implements OnInit {
]
).pipe(
map((latestData) => {
const searchText = latestData[0];
let searchText = latestData[0];
if (!searchText.length) {
return {
searchText: '',
@ -144,15 +150,15 @@ export class SearchFormComponent implements OnInit {
const addressPrefixSearchResults = result[0];
const lightningResults = result[1];
if (this.network === 'bisq') {
return searchText.map((address: string) => 'B' + address);
}
const matchesBlockHeight = this.regexBlockheight.test(searchText);
const matchesTxId = this.regexTransaction.test(searchText) && !this.regexBlockhash.test(searchText);
const matchesBlockHash = this.regexBlockhash.test(searchText);
const matchesAddress = this.regexAddress.test(searchText);
if (matchesAddress && this.network === 'bisq') {
searchText = 'B' + searchText;
}
return {
searchText: searchText,
hashQuickMatch: +(matchesBlockHeight || matchesBlockHash || matchesTxId || matchesAddress),