|
@ -1,4 +1,4 @@ |
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
import { Component, OnInit, HostListener } from '@angular/core'; |
|
|
import { ActivatedRoute } from '@angular/router'; |
|
|
import { ActivatedRoute } from '@angular/router'; |
|
|
|
|
|
|
|
|
import { Balance } from '../../models/balance'; |
|
|
import { Balance } from '../../models/balance'; |
|
@ -6,6 +6,8 @@ import { AddressesService } from '../../services/addresses.service'; |
|
|
import { ErrorService } from '../../services/error.service'; |
|
|
import { ErrorService } from '../../services/error.service'; |
|
|
import { LightWalletTransaction } from '../..//models/light-wallet-transaction'; |
|
|
import { LightWalletTransaction } from '../..//models/light-wallet-transaction'; |
|
|
|
|
|
|
|
|
|
|
|
import { getNumberOfRowsForScreen } from '../../utils'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'app-address-details', |
|
|
selector: 'app-address-details', |
|
|
templateUrl: './address-details.component.html', |
|
|
templateUrl: './address-details.component.html', |
|
@ -17,7 +19,7 @@ export class AddressDetailsComponent implements OnInit { |
|
|
addressString: string; |
|
|
addressString: string; |
|
|
|
|
|
|
|
|
// pagination
|
|
|
// pagination
|
|
|
limit = 10; |
|
|
limit = 30; |
|
|
items: LightWalletTransaction[] = []; |
|
|
items: LightWalletTransaction[] = []; |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
@ -26,6 +28,8 @@ export class AddressDetailsComponent implements OnInit { |
|
|
private errorService: ErrorService) { } |
|
|
private errorService: ErrorService) { } |
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
ngOnInit() { |
|
|
|
|
|
const height = this.getScreenSize(); |
|
|
|
|
|
this.limit = getNumberOfRowsForScreen(height); |
|
|
this.addressString = this.route.snapshot.paramMap.get('address'); |
|
|
this.addressString = this.route.snapshot.paramMap.get('address'); |
|
|
this.addressesService.get(this.addressString).subscribe( |
|
|
this.addressesService.get(this.addressString).subscribe( |
|
|
response => this.onAddressRetrieved(response), |
|
|
response => this.onAddressRetrieved(response), |
|
@ -47,10 +51,15 @@ export class AddressDetailsComponent implements OnInit { |
|
|
|
|
|
|
|
|
this.addressesService |
|
|
this.addressesService |
|
|
.getTransactionsV2(this.addressString, this.limit, lastSeenTxid, order) |
|
|
.getTransactionsV2(this.addressString, this.limit, lastSeenTxid, order) |
|
|
.do(response => this.items = this.items.concat(response.data)) |
|
|
.do(response => this.items.push(...response.data)) |
|
|
.subscribe(); |
|
|
.subscribe(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HostListener('window:resize', ['$event']) |
|
|
|
|
|
private getScreenSize(_?): number { |
|
|
|
|
|
return window.innerHeight; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private onError(response: any) { |
|
|
private onError(response: any) { |
|
|
this.errorService.renderServerErrors(null, response); |
|
|
this.errorService.renderServerErrors(null, response); |
|
|
} |
|
|
} |
|
|