diff --git a/static/src/app/app.component.ts b/static/src/app/app.component.ts index 11cb595..2b844b7 100644 --- a/static/src/app/app.component.ts +++ b/static/src/app/app.component.ts @@ -1,4 +1,4 @@ -import {Component} from '@angular/core'; +import {Component, HostListener} from '@angular/core'; import {NavigationEnd, NavigationStart, Router} from '@angular/router'; import {LoginService} from './services/login-service/login-service'; import {PromotionService} from "./services/promotion-service/promotion.service"; @@ -18,9 +18,9 @@ export class AppComponent { loading: boolean = false; - version = 'v' + require('./../../../package.json').version;; + version = 'v' + require('./../../../package.json').version; -constructor(public loginService: LoginService, + constructor(public loginService: LoginService, private promotionService: PromotionService, private awardingService: AwardingService, private router: Router) { @@ -30,14 +30,13 @@ constructor(public loginService: LoginService, } if (event instanceof NavigationEnd) { this.loading = false; - // if (!router.url.includes('right')) { - // window.scrollTo(0, 0); - // } + if (router.url.includes('stats') || router.url.includes('overview')) { + window.scrollTo({left: 0, top: 0, behavior: 'smooth'}); + } } }); } - ngOnInit() { if (this.loginService.hasPermission(2)) { const fraction = this.loginService.getCurrentUser().squad.fraction; 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 fb894eb..525e7eb 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.html +++ b/static/src/app/statistic/war-detail/war-detail.component.html @@ -1,4 +1,4 @@ -
+
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 9a55c0d..2952cc4 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.ts +++ b/static/src/app/statistic/war-detail/war-detail.component.ts @@ -1,4 +1,4 @@ -import {Component} from "@angular/core"; +import {Component, ElementRef, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {WarService} from "../../services/war-service/war.service"; import {War} from "../../models/model-interfaces"; @@ -17,6 +17,8 @@ export class WarDetailComponent { playerChart: any[] = []; + @ViewChild('overview') private overviewContainer: ElementRef; + cellHeight = 40; rows = []; @@ -52,6 +54,7 @@ export class WarDetailComponent { "value": war.playersBlufor } ]; + this.scrollOverviewTop(); }); } @@ -72,4 +75,11 @@ export class WarDetailComponent { } } + scrollOverviewTop() { + try { + this.overviewContainer.nativeElement.scrollTop = 0; + } catch (err) { + } + } + }