Browse Source

League table API integration

master
kj1352 4 years ago
parent
commit
f54e034051
5 changed files with 53 additions and 61 deletions
  1. +9
    -9
      src/app/league-table/league-table.page.html
  2. +1
    -1
      src/app/league-table/league-table.page.scss
  3. +31
    -31
      src/app/league-table/league-table.page.ts
  4. +3
    -6
      src/app/live/live.page.html
  5. +9
    -14
      src/app/live/live.page.scss

+ 9
- 9
src/app/league-table/league-table.page.html View File

@@ -9,7 +9,7 @@
</div> </div>
</section> </section>


<div class="table-container" *ngIf="tableData">
<div class="table-container" *ngIf="standings">


<table class="team"> <table class="team">
<thead> <thead>
@@ -20,9 +20,9 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of tableData">
<tr *ngFor="let standing of standings">
<td> <td>
{{ data.team }}
{{ standing.short_name }}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -49,21 +49,21 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of tableData">
<tr *ngFor="let standing of standings">
<td> <td>
{{ data.played }}
{{ standing.total }}
</td> </td>
<td> <td>
{{ data.won }}
{{ standing.wins }}
</td> </td>
<td> <td>
{{ data.lost }}
{{ standing.lost }}
</td> </td>
<td> <td>
{{ data.tied }}
{{ standing.tied }}
</td> </td>
<td> <td>
{{ data.netrr }}
{{ standing.net_run_rate }}
</td> </td>
</tr> </tr>
</tbody> </tbody>


+ 1
- 1
src/app/league-table/league-table.page.scss View File

@@ -39,6 +39,7 @@
color: white; color: white;
background-color: darken($brand-blue, 15%); background-color: darken($brand-blue, 15%);
table-layout:fixed; table-layout:fixed;
height: 100%;
thead { thead {
background-color: rgba($green, 0.3); background-color: rgba($green, 0.3);
@@ -53,7 +54,6 @@
td { td {
font-size: 16px; font-size: 16px;
height: 50px; height: 50px;
padding: 30px 0;
} }
} }
} }

+ 31
- 31
src/app/league-table/league-table.page.ts View File

@@ -1,5 +1,23 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { MatchService } from '../services/match.service';
import { ToastService } from '../services/toast.service';

export interface MobileAppStanding {
id: string;
name: string;
short_name: string;
position: number;

total: number;
wins: number;
lost: number;
tied: number;
no_result: number;

net_run_rate: number;
}


@Component({ @Component({
selector: 'app-league-table', selector: 'app-league-table',
@@ -8,39 +26,21 @@ import { Location } from '@angular/common';
}) })
export class LeagueTablePage implements OnInit { export class LeagueTablePage implements OnInit {


tableData = [{
team: 'KXIP',
played: '20',
won: '10',
lost: '9',
tied: '1',
netrr: '+1.107'
}, {
team: 'MI',
played: '20',
won: '10',
lost: '9',
tied: '1',
netrr: '+1.107'
}, {
team: 'RCB',
played: '20',
won: '10',
lost: '9',
tied: '1',
netrr: '+1.107'
}, {
team: 'CSK',
played: '20',
won: '10',
lost: '9',
tied: '1',
netrr: '+1.107'
}];

constructor(private location: Location) { }
standings: Array<MobileAppStanding> = [];

constructor(
private location: Location,
private matchService: MatchService,
private toastService: ToastService
) { }


ngOnInit() { ngOnInit() {
this.matchService.getLeagueTable().then((data: Array<MobileAppStanding>) => {
this.standings = data;
}, (err) => {
console.log(err);
this.toastService.presentToastWithOptions("Failed to get standings data", "danger");
});
} }


back() { back() {


+ 3
- 6
src/app/live/live.page.html View File

@@ -36,7 +36,7 @@
</section> --> </section> -->
</section> </section>


<ul class="statistical-pages">
<ul class="statistical-pages">
<li class="collapsible-card" [ngClass]="{'active' : showFixtures}"> <li class="collapsible-card" [ngClass]="{'active' : showFixtures}">
<header> <header>
<label> Fixtures </label> <label> Fixtures </label>
@@ -59,8 +59,7 @@
<section class="content"> <section class="content">
<section class="match-day-card"> <section class="match-day-card">
<div class="teams"> <div class="teams">
{{ fixture.team_a_short }}
<span></span>
{{ fixture.team_a_short }} <span> vs </span>
{{ fixture.team_b_short }} {{ fixture.team_b_short }}
</div> </div>
@@ -69,9 +68,7 @@
<br> <br>
<br> <br>
{{ fixture.venue }} {{ fixture.venue }}
</p>
<!-- <h4> {{ fixture.team_a_short }} v/s {{ fixture.team_b_short }}</h4> -->
</p>
</section> </section>
</section> </section>


+ 9
- 14
src/app/live/live.page.scss View File

@@ -289,7 +289,7 @@ ion-slides {


.teams { .teams {
display: flex; display: flex;
justify-content: space-between;
justify-content: center;
width: 130px; width: 130px;
margin: 0 auto -25px auto; margin: 0 auto -25px auto;
height: 50px; height: 50px;
@@ -300,18 +300,13 @@ ion-slides {
position: relative; position: relative;
transform: translateY(-25px); transform: translateY(-25px);
z-index: 1; z-index: 1;
font-size: 0.9rem;
color: darken($brand-blue, 20%);
font-weight: 500;


span { span {
font-size: 1rem;
width: 12px;
height: 3px;
background-color: darken(#cecece, 15%);
}
img {
width: 33px;
height: 33px;
border-radius: 50%;
font-size: 0.7rem;
padding: 0 10px;
} }
} }


@@ -323,19 +318,19 @@ ion-slides {


.event-details { .event-details {
margin: 20px 0 5px; margin: 20px 0 5px;
color: darken(#cecece, 30%);
color: lighten($brand-red, 20%);
font-size: 0.8rem; font-size: 0.8rem;
font-weight: 500; font-weight: 500;
} }


h4 { h4 {
color: darken(#cecece, 50%);
color: lighten($brand-red, 20%);
font-size: 1.1rem; font-size: 1.1rem;
line-height: 1.5; line-height: 1.5;
} }


h5 { h5 {
color: darken(#cecece, 50%);
color: lighten($brand-red, 20%);
font-size: 0.9rem; font-size: 0.9rem;
line-height: 1.5; line-height: 1.5;
} }

Loading…
Cancel
Save