Rearrange leaderboard order

This commit is contained in:
Liam Westby 2018-06-03 21:40:24 -05:00
parent 8a7ddfc8b1
commit 7dbe318f58
2 changed files with 60 additions and 63 deletions

View File

@ -3,64 +3,6 @@
</div>
<div id="boardContainer">
<div id="wins" class="leaderboard" *ngIf="currentBoard === 'wins'" [@swap]="currentBoard">
<div class="row header">
<span class="rank">Rank</span>
<span class="player">Player</span>
<span class="value">Wins</span>
</div>
<div *ngFor="let r of winsRankings, let i = index" [ngClass]="{
row: true,
body: true,
first: i === 0,
second: i === 1,
third: i === 2
}">
<span class="rank">{{i + 1}}</span>
<span class="player">{{r.name}}</span>
<span class="value">{{r.numWins}}</span>
</div>
</div>
<div id="games" class="leaderboard" *ngIf="currentBoard === 'totalGames'" [@swap]="currentBoard">
<div class="row header">
<span class="rank">Rank</span>
<span class="player">Player</span>
<span class="value">Games</span>
</div>
<div *ngFor="let r of gamesRankings, let i = index" [ngClass]="{
row: true,
body: true,
first: i === 0,
second: i === 1,
third: i === 2
}">
<span class="rank">{{i + 1}}</span>
<span class="player">{{r.name}}</span>
<span class="value">{{r.totalGames}}</span>
</div>
</div>
<div id="ratio" class="leaderboard" *ngIf="currentBoard === 'winLossRatio'" [@swap]="currentBoard">
<div class="row header">
<span class="rank">Rank</span>
<span class="player">Player</span>
<span class="value">Win Rate</span>
</div>
<div *ngFor="let r of ratioRankings, let i = index" [ngClass]="{
row: true,
body: true,
first: i === 0,
second: i === 1,
third: i === 2
}">
<span class="rank">{{i + 1}}</span>
<span class="player">{{r.name}}</span>
<!-- Format is minimum one place before decimal, min and max 2 places after decimal. -->
<span class="value">{{r.winLossRatio | number: '1.2-2'}}%</span>
</div>
</div>
<div id="rating" class="leaderboard" *ngIf="currentBoard === 'rating'" [@swap]="currentBoard">
<div class="row header">
<span class="rank">Rank</span>
@ -79,4 +21,59 @@
<span class="value">{{r.rating}}</span>
</div>
</div>
<div id="ratio" class="leaderboard" *ngIf="currentBoard === 'winLossRatio'" [@swap]="currentBoard">
<div class="row header">
<span class="rank">Rank</span>
<span class="player">Player</span>
<span class="value">Win Rate</span>
</div>
<div *ngFor="let r of ratioRankings, let i = index" [ngClass]="{
row: true,
body: true,
first: i === 0,
second: i === 1,
third: i === 2
}">
<span class="rank">{{i + 1}}</span>
<span class="player">{{r.name}}</span>
<!-- Format is minimum one place before decimal, min and max 2 places after decimal. -->
<span class="value">{{r.winLossRatio | number: '1.2-2'}}%</span>
</div>
</div>
<div id="wins" class="leaderboard" *ngIf="currentBoard === 'wins'" [@swap]="currentBoard">
<div class="row header">
<span class="rank">Rank</span>
<span class="player">Player</span>
<span class="value">Wins</span>
</div>
<div *ngFor="let r of winsRankings, let i = index" [ngClass]="{
row: true,
body: true,
first: i === 0,
second: i === 1,
third: i === 2
}">
<span class="rank">{{i + 1}}</span>
<span class="player">{{r.name}}</span>
<span class="value">{{r.numWins}}</span>
</div>
</div>
<div id="games" class="leaderboard" *ngIf="currentBoard === 'totalGames'" [@swap]="currentBoard">
<div class="row header">
<span class="rank">Rank</span>
<span class="player">Player</span>
<span class="value">Games</span>
</div>
<div *ngFor="let r of gamesRankings, let i = index" [ngClass]="{
row: true,
body: true,
first: i === 0,
second: i === 1,
third: i === 2
}">
<span class="rank">{{i + 1}}</span>
<span class="player">{{r.name}}</span>
<span class="value">{{r.totalGames}}</span>
</div>
</div>
</div>

View File

@ -84,16 +84,16 @@ export class LeaderboardComponent implements OnInit {
nextLeaderboard(board: number) {
switch (board % 4) {
case 0:
this.currentBoard = 'wins';
this.currentBoard = 'rating';
break;
case 1:
this.currentBoard = 'totalGames';
break;
case 2:
this.currentBoard = 'winLossRatio';
break;
case 2:
this.currentBoard = 'wins';
break;
default:
this.currentBoard = 'rating';
this.currentBoard = 'totalGames';
break;
}
}