diff --git a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.css b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.css index a525771..58a0d9c 100644 --- a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.css +++ b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.css @@ -1,3 +1,8 @@ +.player-campaign-detail-container { + padding: 0 1% 0 1%; + border-top: thin solid lightgrey; +} + h2 { padding: 10px; } diff --git a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.html b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.html index d9a92f9..3f0e0e8 100644 --- a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.html +++ b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.html @@ -1,10 +1,9 @@ -
+

Kampagnendetails - {{campaignPlayer.name}}

{{campaignPlayer.campaign.title}} Kampagne

< Zurück -
[params['id'], params['playerName']]) - .flatMap(id => this.playerService.getCampaignPlayer(id[0], encodeURIComponent(id[1]))) + this.playerService.getCampaignPlayer(this.campaignId, encodeURIComponent(this.playerName)) .subscribe(campaignPlayer => { this.campaignPlayer = campaignPlayer; this.killData = this.assignData(this.yAxisKill, "kill"); @@ -91,14 +93,10 @@ export class CampaignPlayerDetailComponent { this.reviveData = this.assignData(this.yAxisRevive, "revive"); this.captureData = this.assignData(this.yAxisCapture, "flagTouch"); - if (this.totalDeath === 0) { - // avoid infinite or NaN with no death - this.totalDeath = 1; - } - this.kdRatio = parseFloat((this.totalKills / this.totalDeath).toFixed(2)); + this.kdRatio = parseFloat((this.totalKills / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2)); if (this.kdRatio > 1) this.maxKd = this.kdRatio * 1.7; - this.respawnDeathRatio = parseFloat((this.totalRespawn / this.totalDeath).toFixed(2)); + this.respawnDeathRatio = parseFloat((this.totalRespawn / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2)); this.sumData = [ { @@ -177,7 +175,7 @@ export class CampaignPlayerDetailComponent { } navigateBack() { - this.location.back(); + this.switchTab.emit(0); } } diff --git a/static/src/app/statistic/war-detail/scoreboard/scoreboard.component.html b/static/src/app/statistic/war-detail/scoreboard/scoreboard.component.html index cb70ec2..4b0020e 100644 --- a/static/src/app/statistic/war-detail/scoreboard/scoreboard.component.html +++ b/static/src/app/statistic/war-detail/scoreboard/scoreboard.component.html @@ -1,4 +1,4 @@ -
+
- Gesamt + Gesamt diff --git a/static/src/app/statistic/war-detail/scoreboard/scoreboard.component.ts b/static/src/app/statistic/war-detail/scoreboard/scoreboard.component.ts index 945fbbe..4d9b059 100644 --- a/static/src/app/statistic/war-detail/scoreboard/scoreboard.component.ts +++ b/static/src/app/statistic/war-detail/scoreboard/scoreboard.component.ts @@ -1,5 +1,4 @@ -import {Component, ElementRef, SimpleChanges, ViewChild} from "@angular/core"; -import {ActivatedRoute, Router} from "@angular/router"; +import {Component, ElementRef, EventEmitter, SimpleChanges, ViewChild} from "@angular/core"; import {War} from "../../../models/model-interfaces"; import {Fraction} from "../../../utils/fraction.enum"; @@ -7,13 +6,14 @@ import {Fraction} from "../../../utils/fraction.enum"; selector: 'scoreboard', templateUrl: './scoreboard.component.html', inputs: ['war', 'fractionFilterSelected'], + outputs: ['playerTabSwitch'], styleUrls: ['./scoreboard.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css'] }) export class ScoreboardComponent { readonly fraction = Fraction; - @ViewChild('overview') private overviewContainer: ElementRef; + playerTabSwitch = new EventEmitter(); war: War; @@ -30,16 +30,14 @@ export class ScoreboardComponent { sortDescending: 'glyphicon glyphicon-triangle-bottom', }; - constructor(private route: ActivatedRoute, - private router: Router) { + constructor() { } ngOnInit() { } - selectPlayerDetail(playerName: string) { - this.router.navigate(['../../campaign-player/' + this.war.campaign + '/' + playerName], - {relativeTo: this.route}); + selectPlayerDetail(view: number, playerName: string) { + this.playerTabSwitch.emit({view: view, player: playerName}) } ngOnChanges(changes: SimpleChanges) { @@ -49,14 +47,6 @@ export class ScoreboardComponent { if (changes.fractionFilterSelected) { this.filterPlayersByFraction(this.fractionFilterSelected) } - this.scrollOverviewTop(); - } - - scrollOverviewTop() { - try { - this.overviewContainer.nativeElement.scrollTop = 0; - } catch (err) { - } } filterPlayersByFraction(fraction?: string) { diff --git a/static/src/app/statistic/war-detail/war-detail.component.css b/static/src/app/statistic/war-detail/war-detail.component.css index 11f1770..9f2dc98 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.css +++ b/static/src/app/statistic/war-detail/war-detail.component.css @@ -36,6 +36,6 @@ color: #FFF !important; } -.nav-tabs > li.deactivated > a.nav-link{ - cursor: not-allowed!important; +.nav-tabs > li.deactivated > a.nav-link { + cursor: not-allowed !important; } diff --git a/static/src/app/statistic/war-detail/war-detail.component.html b/static/src/app/statistic/war-detail/war-detail.component.html index 44e04a0..ea77b1b 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.html +++ b/static/src/app/statistic/war-detail/war-detail.component.html @@ -66,13 +66,20 @@ + [fractionFilterSelected]="fractionFilterSelected" + (playerTabSwitch)="switchToPlayerTab($event)"> + +
diff --git a/static/src/app/statistic/war-detail/war-detail.component.ts b/static/src/app/statistic/war-detail/war-detail.component.ts index 5560a9e..8f22cec 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.ts +++ b/static/src/app/statistic/war-detail/war-detail.component.ts @@ -20,6 +20,10 @@ export class WarDetailComponent { logData; + singlePlayerView: number; + + playerDetailName: string; + tab: number; fractionStatsInitialized: boolean; @@ -45,7 +49,7 @@ export class WarDetailComponent { .subscribe(war => { this.war = war; - this.tab = 0; + this.switchTab(0); this.fractionStatsInitialized = false; this.fractionFilterSelected = undefined; @@ -62,6 +66,17 @@ export class WarDetailComponent { this.fractionStatsInitialized = true; }); } + window.scroll({left: 0, top: 0, behavior: 'smooth'}); + } + + /** + * called by EventEmitter, + * @param event with fields: 'view' (0 = war-detail, 1 = campaign-detail); 'player' = player name + */ + switchToPlayerTab(event) { + this.singlePlayerView = event.view; + this.playerDetailName = event.player; + this.switchTab(2); } filterPlayersByFraction(fraction?: string) { diff --git a/static/src/app/users/user-list/user-list.component.html b/static/src/app/users/user-list/user-list.component.html index 952dd50..0d664f9 100644 --- a/static/src/app/users/user-list/user-list.component.html +++ b/static/src/app/users/user-list/user-list.component.html @@ -31,7 +31,7 @@ [user]="user" (userDelete)="deleteUser(user)" (userSelected)="selectUser($event)" - (userAward)="awardUser($event, $event)" + (userAward)="awardUser($event)" [selected]="user._id == selectedUserId">
diff --git a/static/src/main.ts b/static/src/main.ts index 50ed715..57d0769 100644 --- a/static/src/main.ts +++ b/static/src/main.ts @@ -4,29 +4,6 @@ import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {AppModule} from './app/app.module'; import {environment} from './environments/environment'; - -import 'rxjs/add/observable/of'; -import 'rxjs/add/operator/retryWhen'; -import 'rxjs/add/observable/fromEvent'; -import 'rxjs/add/observable/from'; -import 'rxjs/add/observable/range'; -import 'rxjs/add/observable/timer'; -import 'rxjs/add/observable/merge'; -import 'rxjs/add/observable/interval'; - -import 'rxjs/add/operator/filter'; -import 'rxjs/add/operator/debounceTime'; -import 'rxjs/add/operator/distinctUntilChanged'; -import 'rxjs/add/operator/mergeMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/retry'; -import 'rxjs/add/operator/bufferCount'; -import 'rxjs/add/operator/bufferTime'; -import 'rxjs/add/operator/take'; -import 'rxjs/add/operator/delay'; - if (environment.production) { enableProdMode(); }