diff --git a/src/app/components/player-info-clan-info/player-info-clan-info.component.html b/src/app/components/player-info-clan-info/player-info-clan-info.component.html new file mode 100644 index 0000000..baf8767 --- /dev/null +++ b/src/app/components/player-info-clan-info/player-info-clan-info.component.html @@ -0,0 +1,6 @@ +
+ Card Header +
+ Card Body +
+
diff --git a/src/app/components/player-info-clan-info/player-info-clan-info.component.scss b/src/app/components/player-info-clan-info/player-info-clan-info.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/player-info-clan-info/player-info-clan-info.component.spec.ts b/src/app/components/player-info-clan-info/player-info-clan-info.component.spec.ts new file mode 100644 index 0000000..42479b7 --- /dev/null +++ b/src/app/components/player-info-clan-info/player-info-clan-info.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PlayerInfoClanInfoComponent } from './player-info-clan-info.component'; + +describe('PlayerInfoClanInfoComponent', () => { + let component: PlayerInfoClanInfoComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [PlayerInfoClanInfoComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(PlayerInfoClanInfoComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/player-info-clan-info/player-info-clan-info.component.ts b/src/app/components/player-info-clan-info/player-info-clan-info.component.ts new file mode 100644 index 0000000..fdeaca1 --- /dev/null +++ b/src/app/components/player-info-clan-info/player-info-clan-info.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-player-info-clan-info', + imports: [], + templateUrl: './player-info-clan-info.component.html', + styleUrl: './player-info-clan-info.component.scss', +}) +export class PlayerInfoClanInfoComponent { + constructor() {} + +} + diff --git a/src/app/components/player-info-latest-activity/player-info-latest-activity.component.html b/src/app/components/player-info-latest-activity/player-info-latest-activity.component.html new file mode 100644 index 0000000..94a5810 --- /dev/null +++ b/src/app/components/player-info-latest-activity/player-info-latest-activity.component.html @@ -0,0 +1 @@ +

player-info-latest-activity works!

diff --git a/src/app/components/player-info-latest-activity/player-info-latest-activity.component.scss b/src/app/components/player-info-latest-activity/player-info-latest-activity.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/player-info-latest-activity/player-info-latest-activity.component.spec.ts b/src/app/components/player-info-latest-activity/player-info-latest-activity.component.spec.ts new file mode 100644 index 0000000..03ee2f8 --- /dev/null +++ b/src/app/components/player-info-latest-activity/player-info-latest-activity.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PlayerInfoLatestActivityComponent } from './player-info-latest-activity.component'; + +describe('PlayerInfoLatestActivityComponent', () => { + let component: PlayerInfoLatestActivityComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [PlayerInfoLatestActivityComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(PlayerInfoLatestActivityComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/player-info-latest-activity/player-info-latest-activity.component.ts b/src/app/components/player-info-latest-activity/player-info-latest-activity.component.ts new file mode 100644 index 0000000..ef288ec --- /dev/null +++ b/src/app/components/player-info-latest-activity/player-info-latest-activity.component.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-player-info-latest-activity', + imports: [], + templateUrl: './player-info-latest-activity.component.html', + styleUrl: './player-info-latest-activity.component.scss' +}) +export class PlayerInfoLatestActivityComponent { + +} diff --git a/src/app/components/player-info-ranking/player-info-ranking.component.html b/src/app/components/player-info-ranking/player-info-ranking.component.html new file mode 100644 index 0000000..12f6d88 --- /dev/null +++ b/src/app/components/player-info-ranking/player-info-ranking.component.html @@ -0,0 +1,33 @@ +
+
    +
  • Worldwide Top
  • +
  • Clan Top
  • +
+
+
+ + + + + + @for (field of playerRankFields; track field) { + + } + + + + @for (playerRank of playerRanks; track playerRank.topPosition) { + + + + + + + + + } + +
{{ field }}
{{ playerRank.topPosition }}{{ playerRank.playerName }}{{ playerRank.experience.value }}{{ playerRank.rankingPoints.value }}{{ playerRank.aliensDestroyed.value }}{{ playerRank.shipsDestroyed.value }}
+
+
+
diff --git a/src/app/components/player-info-ranking/player-info-ranking.component.scss b/src/app/components/player-info-ranking/player-info-ranking.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/player-info-ranking/player-info-ranking.component.spec.ts b/src/app/components/player-info-ranking/player-info-ranking.component.spec.ts new file mode 100644 index 0000000..63ed6d0 --- /dev/null +++ b/src/app/components/player-info-ranking/player-info-ranking.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PlayerInfoRankingComponent } from './player-info-ranking.component'; + +describe('PlayerInfoRankingComponent', () => { + let component: PlayerInfoRankingComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [PlayerInfoRankingComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(PlayerInfoRankingComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/player-info-ranking/player-info-ranking.component.ts b/src/app/components/player-info-ranking/player-info-ranking.component.ts new file mode 100644 index 0000000..1fc9f81 --- /dev/null +++ b/src/app/components/player-info-ranking/player-info-ranking.component.ts @@ -0,0 +1,134 @@ +import { Component, OnInit } from '@angular/core'; +import { ApiService } from '../../services/api.service'; + +@Component({ + selector: 'app-player-info-ranking', + imports: [], + templateUrl: './player-info-ranking.component.html', + styleUrl: './player-info-ranking.component.scss', +}) +export class PlayerInfoRankingComponent implements OnInit { + constructor(private apiService: ApiService) {} + + playerRanks: PlayerRankDto[] = []; + playerRankFields: PlayerRankField[] = ['EXP', 'RP', 'ALD', 'SLD']; + + ngOnInit(): void { + this.playerRanks = this.getPlayerRanks(); + } + + getPlayerRanks(): PlayerRankDto[] { + + //TODO: actual api call here + return [ + { + topPosition: 1, + playerName: 'Player 1', + experience: { + shortName: 'EXP', + value: 1000, + }, + rankingPoints: { + shortName: 'RP', + value: 2000, + }, + aliensDestroyed: { + shortName: 'ALD', + value: 3000, + }, + shipsDestroyed: { + shortName: 'SLD', + value: 4000, + }, + }, + { + topPosition: 2, + playerName: 'Player 2', + experience: { + shortName: 'EXP', + value: 1000, + }, + rankingPoints: { + shortName: 'RP', + value: 2000, + }, + aliensDestroyed: { + shortName: 'ALD', + value: 3000, + }, + shipsDestroyed: { + shortName: 'SLD', + value: 4000, + }, + }, + { + topPosition: 3, + playerName: 'Player 3', + experience: { + shortName: 'EXP', + value: 1000, + }, + rankingPoints: { + shortName: 'RP', + value: 2000, + }, + aliensDestroyed: { + shortName: 'ALD', + value: 3000, + }, + shipsDestroyed: { + shortName: 'SLD', + value: 4000, + }, + }, + { + topPosition: 4, + playerName: 'Player 4', + experience: { + shortName: 'EXP', + value: 1000, + }, + rankingPoints: { + shortName: 'RP', + value: 2000, + }, + aliensDestroyed: { + shortName: 'ALD', + value: 3000, + }, + shipsDestroyed: { + shortName: 'SLD', + value: 4000, + }, + }, + ]; + } +} + +type PlayerRankField = FieldsWithShortName; +type FieldsWithShortName = { + [K in keyof PlayerRankDto]: PlayerRankDto[K] extends { shortName: infer S } + ? S + : never; +}[keyof PlayerRankDto]; + +export type PlayerRankDto = { + topPosition: number; + playerName: string; + experience: { + shortName: 'EXP'; + value: number; + }; + rankingPoints: { + shortName: 'RP'; + value: number; + }; + aliensDestroyed: { + shortName: 'ALD'; + value: number; + }; + shipsDestroyed: { + shortName: 'SLD'; + value: number; + }; +}; diff --git a/src/app/pilot-info/pilot-info.component.html b/src/app/pilot-info/pilot-info.component.html index c0e992f..969d2d7 100644 --- a/src/app/pilot-info/pilot-info.component.html +++ b/src/app/pilot-info/pilot-info.component.html @@ -1,4 +1,7 @@
+ + +
diff --git a/src/app/pilot-info/pilot-info.component.ts b/src/app/pilot-info/pilot-info.component.ts index 2178e81..589f63d 100644 --- a/src/app/pilot-info/pilot-info.component.ts +++ b/src/app/pilot-info/pilot-info.component.ts @@ -1,10 +1,19 @@ import { Component } from '@angular/core'; import { PlayerInfoGeneralInfoComponent } from '../components/player-info-general-info/player-info-general-info.component'; import { ThemePickerComponent } from '../components/theme-picker/theme-picker.component'; +import { PlayerInfoClanInfoComponent } from '../components/player-info-clan-info/player-info-clan-info.component'; +import { PlayerInfoLatestActivityComponent } from '../components/player-info-latest-activity/player-info-latest-activity.component'; +import { PlayerInfoRankingComponent } from '../components/player-info-ranking/player-info-ranking.component'; @Component({ selector: 'app-pilot-info', - imports: [PlayerInfoGeneralInfoComponent, ThemePickerComponent], + imports: [ + PlayerInfoGeneralInfoComponent, + ThemePickerComponent, + PlayerInfoClanInfoComponent, + PlayerInfoLatestActivityComponent, + PlayerInfoRankingComponent, + ], templateUrl: './pilot-info.component.html', styleUrl: './pilot-info.component.scss', }) diff --git a/src/app/services/api.service.ts b/src/app/services/api.service.ts index 7ea2339..5835ef5 100644 --- a/src/app/services/api.service.ts +++ b/src/app/services/api.service.ts @@ -26,6 +26,8 @@ import { UnequipShieldRequest, UnequipThrusterRequest, } from '../models/player/EquipUnequipDtos'; +import {PlayerRankDto} from '../components/player-info-ranking/player-info-ranking.component'; +import {Observable} from 'rxjs'; @Injectable({ providedIn: 'root',