Skip to content

Commit

Permalink
web-ui: Implements utils function to get rows to display on richest a…
Browse files Browse the repository at this point in the history
…ddresses
  • Loading branch information
JonSalazar committed Jan 17, 2019
1 parent 79cfe89 commit 28a8a25
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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);
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 28a8a25

Please sign in to comment.