From 330ab9682beef7b1718a110297c80661a031b8de Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 7 Nov 2022 20:02:59 -0600 Subject: [PATCH] "show more" instead of "show all" txos in lists --- .../transactions-list.component.html | 12 ++++++------ .../transactions-list.component.ts | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.html b/frontend/src/app/components/transactions-list/transactions-list.component.html index 96f792f82..80bec2d28 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.html +++ b/frontend/src/app/components/transactions-list/transactions-list.component.html @@ -20,7 +20,7 @@
- + inputRowLimit && tx['@vinLimit']"> + @@ -158,7 +158,7 @@
- +
- + outputRowLimit && tx['@voutLimit']"> + diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.ts b/frontend/src/app/components/transactions-list/transactions-list.component.ts index 9f1245532..e81a79c71 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.ts +++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts @@ -18,6 +18,7 @@ import { ApiService } from '../../services/api.service'; export class TransactionsListComponent implements OnInit, OnChanges { network = ''; nativeAssetId = this.stateService.network === 'liquidtestnet' ? environment.nativeTestAssetId : environment.nativeAssetId; + showMoreIncrement = 40; @Input() transactions: Transaction[]; @Input() showConfirmations = false; @@ -218,6 +219,22 @@ export class TransactionsListComponent implements OnInit, OnChanges { }); } + showMoreInputs(tx: Transaction): void { + tx['@vinLimit'] = this.getVinLimit(tx, true); + } + + showMoreOutputs(tx: Transaction): void { + tx['@voutLimit'] = this.getVoutLimit(tx, true); + } + + getVinLimit(tx: Transaction, next = false): number { + return Math.min(Math.max(tx['@vinLimit'] || 0, this.inputRowLimit) + (next ? this.showMoreIncrement : 0), tx.vin.length); + } + + getVoutLimit(tx: Transaction, next = false): number { + return Math.min(Math.max(tx['@voutLimit'] || 0, this.outputRowLimit) + (next ? this.showMoreIncrement : 0), tx.vout.length); + } + ngOnDestroy(): void { this.outspendsSubscription.unsubscribe(); }
- +