From 0663cc2cfa21088de54da3cb5eedc77c6916391b Mon Sep 17 00:00:00 2001 From: natsee Date: Mon, 22 Jan 2024 11:29:41 +0100 Subject: [PATCH 1/3] Fix search bar result overflow --- .../src/app/components/search-form/search-form.component.scss | 4 ---- .../search-form/search-results/search-results.component.html | 4 ++-- .../search-form/search-results/search-results.component.ts | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/components/search-form/search-form.component.scss b/frontend/src/app/components/search-form/search-form.component.scss index e5233f0cf..cec555a4f 100644 --- a/frontend/src/app/components/search-form/search-form.component.scss +++ b/frontend/src/app/components/search-form/search-form.component.scss @@ -1,15 +1,11 @@ :host ::ng-deep { .dropdown-item { white-space: nowrap; - width: calc(100% - 34px); } .dropdown-menu { width: calc(100% - 34px); } @media (min-width: 768px) { - .dropdown-item { - width: 410px; - } .dropdown-menu { width: 410px; } diff --git a/frontend/src/app/components/search-form/search-results/search-results.component.html b/frontend/src/app/components/search-form/search-results/search-results.component.html index 5d64b7495..51237a1a5 100644 --- a/frontend/src/app/components/search-form/search-results/search-results.component.html +++ b/frontend/src/app/components/search-form/search-results/search-results.component.html @@ -26,7 +26,7 @@
Bitcoin Address
@@ -39,7 +39,7 @@
Other Network Address
diff --git a/frontend/src/app/components/search-form/search-results/search-results.component.ts b/frontend/src/app/components/search-form/search-results/search-results.component.ts index ade01bf89..eb251d087 100644 --- a/frontend/src/app/components/search-form/search-results/search-results.component.ts +++ b/frontend/src/app/components/search-form/search-results/search-results.component.ts @@ -10,7 +10,7 @@ export class SearchResultsComponent implements OnChanges { @Input() results: any = {}; @Output() selectedResult = new EventEmitter(); - isMobile = (window.innerWidth <= 767.98); + isMobile = (window.innerWidth <= 1150); resultsFlattened = []; activeIdx = 0; focusFirst = true; From 00613fe6136fdd327b0408088ab4a6f1077a8a0c Mon Sep 17 00:00:00 2001 From: natsee Date: Mon, 22 Jan 2024 11:45:07 +0100 Subject: [PATCH 2/3] Liquid: suggest asset in search bar results --- .../search-form/search-form.component.ts | 15 +++++++++------ .../search-results/search-results.component.html | 10 ++++++++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/components/search-form/search-form.component.ts b/frontend/src/app/components/search-form/search-form.component.ts index 2a9983a24..3bbe5bccb 100644 --- a/frontend/src/app/components/search-form/search-form.component.ts +++ b/frontend/src/app/components/search-form/search-form.component.ts @@ -170,6 +170,7 @@ export class SearchFormComponent implements OnInit { addresses: [], nodes: [], channels: [], + liquidAsset: [], }; } @@ -187,6 +188,7 @@ export class SearchFormComponent implements OnInit { const matchesBlockHash = this.regexBlockhash.test(searchText); let matchesAddress = !matchesTxId && this.regexAddress.test(searchText); const otherNetworks = findOtherNetworks(searchText, this.network as any || 'mainnet', this.env); + const liquidAsset = this.assets ? (this.assets[searchText] || []) : []; // Add B prefix to addresses in Bisq network if (!matchesAddress && this.network === 'bisq' && getRegex('address', 'mainnet').test(searchText)) { @@ -211,6 +213,7 @@ export class SearchFormComponent implements OnInit { otherNetworks: otherNetworks, nodes: lightningResults.nodes, channels: lightningResults.channels, + liquidAsset: liquidAsset, }; }) ); @@ -259,16 +262,16 @@ export class SearchFormComponent implements OnInit { } else if (this.regexTransaction.test(searchText)) { const matches = this.regexTransaction.exec(searchText); if (this.network === 'liquid' || this.network === 'liquidtestnet') { - if (this.assets[matches[1]]) { - this.navigate('/assets/asset/', matches[1]); + if (this.assets[matches[0]]) { + this.navigate('/assets/asset/', matches[0]); } - this.electrsApiService.getAsset$(matches[1]) + this.electrsApiService.getAsset$(matches[0]) .subscribe( - () => { this.navigate('/assets/asset/', matches[1]); }, + () => { this.navigate('/assets/asset/', matches[0]); }, () => { - this.electrsApiService.getBlock$(matches[1]) + this.electrsApiService.getBlock$(matches[0]) .subscribe( - (block) => { this.navigate('/block/', matches[1], { state: { data: { block } } }); }, + (block) => { this.navigate('/block/', matches[0], { state: { data: { block } } }); }, () => { this.navigate('/tx/', matches[0]); }); } ); diff --git a/frontend/src/app/components/search-form/search-results/search-results.component.html b/frontend/src/app/components/search-form/search-results/search-results.component.html index 51237a1a5..879fc5427 100644 --- a/frontend/src/app/components/search-form/search-results/search-results.component.html +++ b/frontend/src/app/components/search-form/search-results/search-results.component.html @@ -1,4 +1,4 @@ -