diff --git a/src/app/components/player-details/player-details.component.html b/src/app/components/player-details/player-details.component.html
index b7ecd1b..bd3f5cd 100644
--- a/src/app/components/player-details/player-details.component.html
+++ b/src/app/components/player-details/player-details.component.html
@@ -1,87 +1,120 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
- KL Rahul
+
+ {{ playerDetails.name }}
- Batsman,
Wicket Keeper
+ {{ playerDetails.player_skill.text }}
-
-
-
-
-
+
+
+
+
-
- -
-
-
26
-
-
- -
-
-
64
-
-
- -
-
-
18
-
-
-
-
+
+ -
+
+
{{ stat.overall.batting_record.hundreds }}
+
+
+ -
+
+
{{ stat.overall.batting_record.fifties }}
+
+
+ -
+
+
{{ stat.overall.batting_record.strike_rate }}
+
+
+
+ -
+
+
{{ stat.overall.bowling_record.wickets }}
+
+
+ -
+
+
{{ stat.overall.bowling_record.wickets }}
+
+
+ -
+
+
{{ stat.overall.bowling_record.economy_rate }}
+
+
+
+
+
-
-
KL Rahul
+ {{ playerDetails.fullname }}
-
-
-
26
+
+ {{ playerDetails.nick_name }}
-
-
-
Mangaluru
+
+ {{ playerDetails.dob }}
-
-
-
43.64
+
+ {{ playerDetails.place_birth }}
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
{{ stat.overall.batting_record.hundreds }}
+
+
+ -
+
+
{{ stat.overall.batting_record.fifties }}
+
+
+ -
+
+
{{ stat.overall.batting_record.strike_rate }}
+
+
+
+
+ -
+
+
{{ stat.overall.bowling_record.wickets }}
+
+
+ -
+
+
{{ stat.overall.bowling_record.wickets }}
+
+
+ -
+
+
{{ stat.overall.bowling_record.economy_rate }}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/components/player-details/player-details.component.scss b/src/app/components/player-details/player-details.component.scss
index fc34b2b..d17a4c0 100644
--- a/src/app/components/player-details/player-details.component.scss
+++ b/src/app/components/player-details/player-details.component.scss
@@ -3,6 +3,7 @@
.container {
background: linear-gradient(45deg, darken($brand-blue, 15%), darken($brand-blue, 20%) 80%);
padding: 40px 0;
+ width: 100vw;
}
.player-primary-data {
@@ -10,57 +11,12 @@
width: 95%;
padding-left: 5%;
position: relative;
-
- &::before {
- content: '';
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- background-image: url('../../../assets/home-team/KXIP-lion-white.svg');
- background-size: contain;
- background-position: center;
- background-repeat: no-repeat;
- opacity: 0.1;
- }
-
+
.details {
- width: 50%;
+ width: 100%;
position: relative;
}
- .teams-holder {
- position: relative;
- z-index: 0;
- display: flex;
- justify-content: flex-start;
-
- figure {
- width: 50px;
- height: 50px;
- border-radius: 50%;
- position: relative;
- z-index: 1;
- margin: 0;
- display: block;
- overflow: hidden;
- box-shadow: 0px 0px 5px darken($brand-blue, 20%);
-
- &:nth-child(2) {
- z-index: 0;
- transform: translateX(-10px);
- }
-
- img {
- width: 100%;
- height: 100%;
- display: block;
- transform: scale(1.5);
- }
- }
- }
-
.name {
font-size: 2rem;
font-weight: 700;
@@ -86,19 +42,21 @@
color: lighten($brand-red, 15%);
}
}
+}
- .player-image {
- width: 50%;
- display: block;
- height: 40vh;
-
- img {
- display: block;
- object-fit: contain;
- width: 100%;
- height: 100%;
- object-position: bottom;
- }
+.stats-header {
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+ width: 100%;
+ padding: 0 5%;
+
+ h4 {
+ color: $green;
+ font-size: 1.5rem;
+ font-weight: 500;
+ letter-spacing: 0.5px;
+ margin: 0;
}
}
@@ -107,9 +65,8 @@
width: 100%;
padding: 0 5%;
list-style: none;
- margin: 0 auto -30px auto;
+ margin: 20px auto;
justify-content: space-between;
- transform: translateY(-50px);
z-index: 1;
position: relative;
background-color: rgba(darken($brand-blue, 20%), 0.8);
@@ -120,11 +77,8 @@
height: 27vw;
background-color: rgba($brand-blue, 0.8);
border: 1px solid rgba($blue-grey, 0.3);
- display: flex;
border-radius: 10px;
color: white;
- align-items: flex-end;
- justify-content: space-between;
padding: 10px;
overflow: hidden;
position: relative;
@@ -143,115 +97,18 @@
label {
font-weight: 500;
font-size: 0.8rem;
- align-self: flex-start;
- width: 50%;
- overflow: visible;
- white-space: nowrap;
- position: relative;
+ position: absolute;
+ top: 10px;
+ left: 10px;
}
h5 {
- width: 50%;
- white-space: nowrap;
- overflow: visible;
margin: 0;
font-weight: 700;
- font-size: 1.8rem;
- align-self: flex-end;
- text-align: right;
- position: relative;
- }
-}
-
-.news {
- width: 90%;
- margin: 0 auto 20px auto;
-
- header {
- display: flex;
- align-items: center;
- justify-content: flex-start;
-
- h4 {
- color: lighten($green, 10%);
- font-size: 0.8rem;
- font-weight: 500;
- letter-spacing: 0.5px;
- margin: 0;
- }
-
- span {
- margin-right: 10px;
- border: 7px solid lighten($green, 10%);
- border-radius: 50%;
- height: 25px;
- width: 25px;
- background-color: darken($brand-blue, 20%);
- }
- }
-
- ul {
- list-style: none;
- padding: 0;
- background-color: darken($brand-blue, 10%);
- box-shadow: 0px 0px 10px darken($brand-blue, 20%);
- border-radius: 10px;
- overflow: hidden;
-
- li {
- width: 90%;
- margin: 0 auto;
- padding: 15px 0px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1px solid rgba($blue-grey, 0.2);
-
- &:last-child {
- border-bottom: none;
- }
- }
-
- label {
- width: 40px;
- text-align: center;
- color: white;
- font-size: 0.8rem;
- display: block;
- line-height: 1.3;
-
- span {
- color: lighten($brand-blue, 10%);
- font-size: 0.8rem;
- display: block;
- }
- }
-
- p {
- width: calc(100% - 100px);
- font-size: 0.8rem;
- color: white;
- font-weight: 500;
- line-height: 1.5;
- margin: 0;
- }
-
- .share-button {
- width: 30px;
- height: 30px;
- border: 1px solid lighten($brand-blue, 10%);
- background-color: rgba(lighten($brand-blue, 10%), 0.2);
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-left: 10px;
-
- ion-icon {
- color: lighten($brand-blue, 10%);
- font-size: 15px;
- }
- }
+ font-size: 1.5rem;
+ position: absolute;
+ right: 10px;
+ bottom: 10px;
}
}
@@ -261,7 +118,7 @@
border-radius: 10px;
overflow: hidden;
width: 90%;
- margin: 0 auto;
+ margin: 0 auto 40px auto;
padding: 0px 0px 5px 0px;
header {
@@ -269,7 +126,7 @@
font-weight: 500;
color: white;
padding: 15px 5%;
- border-bottom: 1px solid rgba($blue-grey, 0.2);
+ border-bottom: 1px solid lighten($brand-blue, 5%);
margin: 0;
}
@@ -281,12 +138,9 @@
}
li {
- padding: 10px 5px;
- display: flex;
+ padding: 20px 10px;
width: 100%;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1px solid rgba($blue-grey, 0.2);
+ border-bottom: 1px solid lighten($brand-blue, 5%);
text-align: left;
&:last-child {
@@ -295,15 +149,15 @@
}
label {
- color: lighten($brand-blue, 10%);
- font-size: 0.7rem;
+ color: lighten($brand-blue, 20%);
+ font-size: 1rem;
display: block;
line-height: 1.3;
- width: 100px;
+ display: block;
+ margin-bottom: 10px;
}
p {
- width: calc(100% - 100px);
font-size: 0.9rem;
color: white;
font-weight: 500;
diff --git a/src/app/components/player-details/player-details.component.ts b/src/app/components/player-details/player-details.component.ts
index 4fd6c8b..6375791 100644
--- a/src/app/components/player-details/player-details.component.ts
+++ b/src/app/components/player-details/player-details.component.ts
@@ -1,4 +1,110 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Input } from '@angular/core';
+import { MatchService } from '../../services/match.service';
+import { ToastService } from '../../services/toast.service';
+
+
+interface HighestScoreDetails {
+ score: {
+ is_no: string;
+ balls_faced: string;
+ text: string;
+ };
+ match_id: string;
+ match_date: string;
+ vs: IdentifiableData;
+}
+
+interface BattingRecord {
+ matches: string;
+ innings: string;
+ not_outs: string;
+ runs: string;
+ balls_faced: string;
+ hundreds: string;
+ fifties: string;
+ fours: string;
+ sixes: string;
+ average: string;
+ strike_rate: string;
+ hs: HighestScoreDetails;
+}
+
+interface BestBowlingDetails {
+ figure: {
+ wickets: string;
+ runs_given: string;
+ text: string;
+ };
+ match_id: string;
+ match_date: string;
+ vs: HighestScoreDetails;
+}
+
+interface BowlingRecord {
+ matches: string;
+ innings: string;
+ overs: string;
+ balls_bowled: string;
+ maidens: string;
+ runs: string;
+ wickets: string;
+ average: string;
+ strike_rate: string;
+ economy_rate: string;
+ four_wk_hauls: string;
+ five_wk_hauls: string;
+ best_bowling: BestBowlingDetails;
+}
+
+interface FieldingRecord {
+ catches: string;
+ stumpings: string;
+ run_outs: string;
+}
+
+interface StatsForFormat {
+ comp_type_id: string;
+ comp_type: string;
+ rankings: {
+ bat: string;
+ bowl: string;
+ };
+ overall: {
+ batting_record: BattingRecord;
+ bowling_record: BowlingRecord;
+ fielding_record: FieldingRecord;
+ }
+}
+
+interface RawPlayerTeamDetails {
+ id: string;
+ active: string;
+ is_primary: string;
+ is_international: string;
+ text: string;
+}
+
+interface RawPlayerProfile {
+ player_id: string;
+ last_updated: string;
+ fullname: string;
+ name: string;
+ dob: string;
+ date_of_death: string;
+ place_birth: string;
+ nick_name: string;
+ majorteams: {
+ team: Array
;
+ };
+ stats: {
+ format: Array;
+ };
+}
+
+export interface RawPlayerData {
+ profile: RawPlayerProfile;
+}
+
@Component({
selector: 'app-player-details',
@@ -6,9 +112,22 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./player-details.component.scss'],
})
export class PlayerDetailsComponent implements OnInit {
+ @Input() playerId: string;
+ playerDetails: RawPlayerData;
- constructor() { }
+ constructor(
+ private matchService: MatchService,
+ private toastService: ToastService
+ ) { }
- ngOnInit() {}
+ ngOnInit() {
+ this.matchService.getPlayerDetails(this.playerId).then((data: RawPlayerData) => {
+ console.log(data);
+ this.playerDetails = data;
+ }, (err) => {
+ console.log(err);
+ this.toastService.presentToastWithOptions("Failed to fetch player details", "danger");
+ });
+ }
}
diff --git a/src/app/live/live.page.ts b/src/app/live/live.page.ts
index ded2bb3..cd224a5 100644
--- a/src/app/live/live.page.ts
+++ b/src/app/live/live.page.ts
@@ -278,7 +278,7 @@ export class LivePage implements OnInit {
}
showMatchDetails() {
- this.router.navigate(['/match-details']);
+ this.router.navigate(['/match-details', { match_id: this.currentMatch.Matchdetail.Match.Id }]);
}
}
diff --git a/src/app/match-details/match-details.page.html b/src/app/match-details/match-details.page.html
index 2ef39b5..004315c 100644
--- a/src/app/match-details/match-details.page.html
+++ b/src/app/match-details/match-details.page.html
@@ -1,11 +1,11 @@
-
+