Node and Channel pages improvements

This commit is contained in:
softsimon
2022-05-15 19:22:14 +04:00
parent ac10aafc07
commit 9ebc8813e3
16 changed files with 239 additions and 185 deletions

View File

@@ -66,9 +66,9 @@ export class SearchFormComponent implements OnInit {
if (this.network === 'bisq' && text.match(/^(b)[^c]/i)) {
return text.substr(1);
}
return text;
return text.trim();
}),
debounceTime(300),
debounceTime(250),
distinctUntilChanged(),
switchMap((text) => {
if (!text.length) {
@@ -82,7 +82,10 @@ export class SearchFormComponent implements OnInit {
}
return zip(
this.electrsApiService.getAddressesByPrefix$(text).pipe(catchError(() => of([]))),
this.apiService.lightningSearch$(text),
this.apiService.lightningSearch$(text).pipe(catchError(() => of({
nodes: [],
channels: [],
}))),
);
}),
map((result: any[]) => {

View File

@@ -17,8 +17,8 @@
</ng-template>
<ng-template [ngIf]="results.channels.length">
<div class="card-title">Lightning Channels</div>
<ng-template [class.active]="results.addresses.length + results.nodes.length + i === activeIdx" ngFor [ngForOf]="results.channels" let-channel let-i="index">
<button (click)="clickItem(results.addresses.length + results.nodes.length + i)" type="button" role="option" class="dropdown-item">
<ng-template ngFor [ngForOf]="results.channels" let-channel let-i="index">
<button (click)="clickItem(results.addresses.length + results.nodes.length + i)" [class.active]="results.addresses.length + results.nodes.length + i === activeIdx" type="button" role="option" class="dropdown-item">
<ngb-highlight [result]="channel.short_id" [term]="searchTerm"></ngb-highlight> &nbsp;<span class="symbol">{{ channel.id }}</span>
</button>
</ng-template>