diff --git a/src/app/live/live.page.html b/src/app/live/live.page.html index 46ae204..6295424 100644 --- a/src/app/live/live.page.html +++ b/src/app/live/live.page.html @@ -45,7 +45,7 @@ - Player + Batsman Score @@ -57,9 +57,9 @@ - + - {{ currentMatch.Teams[inning.Battingteam].Players[Batsman].Name_Full }}
+ {{ currentMatch.Teams[inning.Battingteam].Players[batsman].Name_Full }}
{{ batsman.Howout }} diff --git a/src/app/match-details/match-details.page.html b/src/app/match-details/match-details.page.html index 669db0a..b6bedb1 100644 --- a/src/app/match-details/match-details.page.html +++ b/src/app/match-details/match-details.page.html @@ -19,13 +19,13 @@ -
+
- - - - +
@@ -158,68 +154,27 @@
Commentary
-
diff --git a/src/app/match-details/match-details.page.scss b/src/app/match-details/match-details.page.scss index c5f2404..a24da9b 100644 --- a/src/app/match-details/match-details.page.scss +++ b/src/app/match-details/match-details.page.scss @@ -62,9 +62,17 @@ } } - p { + .comment { width: calc(100% - 55px); margin: 0; + + p { + margin: 0; + } + + .small-stats { + margin-top: 10px; + } } } diff --git a/src/app/match-details/match-details.page.ts b/src/app/match-details/match-details.page.ts index 574a3ce..a18bdd0 100644 --- a/src/app/match-details/match-details.page.ts +++ b/src/app/match-details/match-details.page.ts @@ -5,6 +5,44 @@ import { MatchService } from '../services/match.service'; import { ToastService } from '../services/toast.service'; import { RawMatchData } from '../live/live.page'; + +interface RawCommentaryForBall { + Over: string; + Id: string; + Runs: string; + ZAD: string; + Detail: string; + Isball: boolean; + Bowler: string; + Bowler_Name: string; + Batsman: string; + Batsman_Name: string; + Batsman_Style: string; + Commentary: string; + Timestamp: string; + Non_Striker: string; + Non_Striker_Name: string; + Score: string; + Batsman_Runs: string; + Bowler_Conceded_Runs: string; + Extras_Runs: string; + Ball_Speed: string; +} + +export interface RawCommentary { + InningNo: string; + BattingTeam_Id: string; + BattingTeam: string; + BowlingTeam_Id: string; + BowlingTeam: string; + GameCode: string; + MatchId: string; + Timestamp: string; + + Commentary: Array; +} + + @Component({ selector: 'app-match-details', templateUrl: './match-details.page.html', @@ -21,6 +59,8 @@ export class MatchDetailsPage implements OnInit { selectedPlayer: string = ''; + commentaryList: Array = []; + constructor( private location: Location, private route: ActivatedRoute, @@ -34,6 +74,13 @@ export class MatchDetailsPage implements OnInit { this.matchService.getMatchDetails(match_id).then((match_data: RawMatchData) => { this.currentMatch = match_data; }); + + this.matchService.getCommentary(match_id).then((data: Array) => { + this.commentaryList = data; + }, (err) => { + console.log(err); + this.toastService.presentToastWithOptions("Failed to fetch Commentary", "danger"); + }) } back() { diff --git a/src/app/services/match.service.ts b/src/app/services/match.service.ts index a1f5c0b..df90df8 100644 --- a/src/app/services/match.service.ts +++ b/src/app/services/match.service.ts @@ -35,4 +35,8 @@ export class MatchService { return this.http.get(BASE_URL + '/player/' + id).toPromise(); } + getCommentary(id: number | string) { + return this.http.get(BASE_URL + '/commentary/' + id).toPromise(); + } + }