From 28a8a2588b23a167ccaaf9c60738cc2d911e97b4 Mon Sep 17 00:00:00 2001 From: jonsadev Date: Wed, 16 Jan 2019 20:05:34 -0700 Subject: [PATCH] web-ui: Implements utils function to get rows to display on richest addresses --- .../richest-addresses.component.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/web-ui/src/app/components/richest-addresses/richest-addresses.component.ts b/web-ui/src/app/components/richest-addresses/richest-addresses.component.ts index 61ff3d5..b743e87 100644 --- a/web-ui/src/app/components/richest-addresses/richest-addresses.component.ts +++ b/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; }