Browse Source

web-ui: Implements utils function to get rows to display on richest addresses

prometheus-integration
jonsadev 6 years ago
parent
commit
28a8a2588b
  1. 13
      web-ui/src/app/components/richest-addresses/richest-addresses.component.ts

13
web-ui/src/app/components/richest-addresses/richest-addresses.component.ts

@ -9,6 +9,8 @@ import { BalancesService } from '../../services/balances.service';
import { TickerService } from '../../services/ticker.service';
import { ServerStats } from '../../models/ticker';
import { getNumberOfRowsForScreen } from '../../utils';
@Component({
selector: 'app-richest-addresses',
templateUrl: './richest-addresses.component.html',
@ -29,7 +31,7 @@ export class RichestAddressesComponent implements OnInit {
ngOnInit() {
const height = this.getScreenSize();
this.limit = this.getLimitForScreen(height);
this.limit = getNumberOfRowsForScreen(height);
this.load();
this.tickerService.get().subscribe(response => this.ticker = response);
}
@ -47,17 +49,10 @@ export class RichestAddressesComponent implements OnInit {
}
@HostListener('window:resize', ['$event'])
private getScreenSize(event?): number {
private getScreenSize(_?): number {
return window.innerHeight;
}
private getLimitForScreen(height: number): number {
if (height < 550) {
return 10;
}
return Math.min(10 + Math.ceil((height - 550) / 20), 100);
}
getPercent(balance: Balance): number {
return balance.available * 100 / this.ticker.circulatingSupply;
}

Loading…
Cancel
Save