"show more" instead of "show all" txos in lists
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user