Compare commits

..

No commits in common. "0fa09b56dccbe2d54e2e8b1ba58f26c71e26d696" and "5d6e3fc0897ca468f2326c294a03a7cd88da0073" have entirely different histories.

28 changed files with 155 additions and 398 deletions

View File

@ -14,7 +14,7 @@
</mat-sidenav> </mat-sidenav>
</mat-sidenav-container> </mat-sidenav-container>
<div style="overflow-x: auto;position: relative;min-height: calc(100vh - 50px);" (click)="sidenav.close()"> <div (click)="sidenav.close()">
<router-outlet></router-outlet> <router-outlet></router-outlet>
<div id="left"> <div id="left">
<router-outlet name="left"></router-outlet> <router-outlet name="left"></router-outlet>

View File

@ -22,14 +22,4 @@ mat-sidenav {
&:hover { &:hover {
background: #101010; background: #101010;
} }
@media all and (max-width: 959px) {
bottom: 0;
left: 0;
width: 100vw;
border-radius: 3px 3px 0 0;
background: #101010;
min-height: 34px;
height: 3vw;
}
} }

View File

@ -5,12 +5,12 @@
@media all and (max-width: 599px) { @media all and (max-width: 599px) {
.squad-layout { .squad-layout {
width: 100vw;
padding: 1vh 1vw; padding: 1vh 1vw;
} }
img { img {
right: 3vw; right: 3vw;
max-width: 27%;
} }
div.name-cell { div.name-cell {
@ -61,10 +61,7 @@
img { img {
position: absolute; position: absolute;
margin-top: 8px; margin-top: 8px;
margin-left: 2%; margin-left: 25px;
@media all and (max-width: 959px) {
margin-left: 0;
}
} }
.title { .title {
@ -75,7 +72,7 @@ img {
.name-cell { .name-cell {
display: inherit; display: inherit;
margin-left: 38%; margin-left: 200px;
} }

View File

@ -1,12 +1,15 @@
@import url('../style/background-image.scss'); @import url('../style/background-image.scss');
.army-content-container { .army-content-container {
width: 90%; width: 1100px;
max-width: 1100px;
margin: auto; margin: auto;
position: relative; position: relative;
} }
.army-column-right {
float: right;
}
@media all and (max-width: 599px) { @media all and (max-width: 599px) {
h1 { h1 {
font-size: 26px; font-size: 26px;
@ -18,17 +21,16 @@
} }
div.army-column { div.army-column {
width: 100%!important; width: 100%;
h3 { h3 {
background: #222; background: #222;
font-size: 18px;
margin: 0.2em 0; margin: 0.2em 0;
padding: 1.5vh 0; padding: 1.5vh 0;
button { button {
position: absolute; position: absolute;
margin-top: -10px; margin-top: -7px;
display: inline-block; display: inline-block;
&.switch-btn-blufor { &.switch-btn-blufor {
@ -41,23 +43,14 @@
} }
mat-icon { mat-icon {
width: 2.5em; width: 3em;
height: 2.5em; height: 3em;
} }
} }
} }
} }
} }
@media all and (max-width: 959px) {
div.army-column {
width: 49%;
}
.army-content-container {
width: 98%;
}
}
.army-column { .army-column {
width: 45%; width: 45%;
} }

View File

@ -1,12 +1,11 @@
.form-signin { .form-signin {
width: 100%; max-width: 330px;
padding: 15px; padding: 15px;
margin: 0 auto; margin: 0 auto;
} }
.form-signin > .row { .form-signin > .row {
max-width: 400px; width: 400px;
margin: auto;
} }
.form-signin-heading { .form-signin-heading {

View File

@ -8,7 +8,7 @@ h1 {
.decoration-overview-container { .decoration-overview-container {
position: relative; position: relative;
z-index: 0; z-index: 0;
margin: auto 4vw 0; margin: auto 140px 30px;
} }
@media all and (max-width: 959px) { @media all and (max-width: 959px) {
@ -73,10 +73,6 @@ h1 {
background: #222222;; background: #222222;;
box-shadow: #666666 2px 2px 8px; box-shadow: #666666 2px 2px 8px;
& > div:hover {
color: #ffffff;
}
@media all and (max-width: 959px) { @media all and (max-width: 959px) {
width: 100%; width: 100%;
height: 50px height: 50px

View File

@ -52,9 +52,8 @@ img.img-medal {
} }
img.img-ribbon { img.img-ribbon {
padding-top: 20px; padding-top: 10%;
width: 60%; width: 55%;
max-width: 130px;
} }
.gradient { .gradient {

View File

@ -22,7 +22,6 @@
h3 { h3 {
margin-top: 0; margin-top: 0;
font-size: 18px;
} }
.mat-column-picture { .mat-column-picture {
@ -31,7 +30,6 @@
.mat-column-name { .mat-column-name {
max-width: 7.5vw; max-width: 7.5vw;
overflow: hidden;
} }
td.mat-cell:first-child { td.mat-cell:first-child {
@ -41,9 +39,12 @@
td > img { td > img {
height: 13vh !important; height: 13vh !important;
max-height: 120px; max-height: 120px;
max-width: 100%;
padding: 4px; padding: 4px;
} }
:host {
margin-bottom: -50vh;
}
} }
table { table {

View File

@ -1,4 +1,3 @@
<div *ngIf="!isSmallLayout">
<div class="scroll-btn" <div class="scroll-btn"
*ngIf="isLeftScrollVisible" *ngIf="isLeftScrollVisible"
(mouseenter)="setRepeater(-10)" (mouseenter)="setRepeater(-10)"
@ -45,25 +44,4 @@
(mouseleave)="clearRepeater()"> (mouseleave)="clearRepeater()">
<mat-icon svgIcon="chevron-right"></mat-icon> <mat-icon svgIcon="chevron-right"></mat-icon>
</div> </div>
</div>
<div *ngIf="isSmallLayout" class="campaign-select-small">
<mat-list-item [matMenuTriggerFor]="menuCampaign">
<div matline class="select-menu-text">
<span *ngIf="selectedCampaignId === 'all'">{{'stats.campaign.title.all.time.overview' | translate}}</span>
<span *ngIf="selectedCampaignId !== 'all' && selectedCampaign">{{selectedCampaign.title}}</span>
<span class="caret"></span>
</div>
</mat-list-item>
<mat-menu #menuCampaign="matMenu">
<button mat-menu-item (click)="select({_id:'all'})">
{{'stats.campaign.title.all.time.overview' | translate}}
</button>
<mat-divider></mat-divider>
<button mat-menu-item *ngFor="let campaign of campaigns$ | async"
(click)="select(campaign)">
{{campaign.title}}
</button>
</mat-menu>
</div>

View File

@ -6,7 +6,7 @@
} }
.scroll-btn-right { .scroll-btn-right {
top: 0; top: 50px;
left: calc(100vw - 50px); left: calc(100vw - 50px);
} }
@ -36,6 +36,10 @@
float: left; float: left;
background: #424242; background: #424242;
color: #9d9d9d; color: #9d9d9d;
@media all and (max-width: 959px) {
min-width: 33%;
}
} }
.active { .active {
@ -47,21 +51,3 @@
.campaign-entry:hover { .campaign-entry:hover {
border-bottom: 3px solid #ffd740; border-bottom: 3px solid #ffd740;
} }
.campaign-select-small {
background: #424242;
height: 3em;
color: #9d9d9d;
text-align: center;
border-bottom: 1px solid #9d9d9d;
.select-menu-text {
font-size: 16px;
}
}
:host /deep/ div.mat-list-item-content {
height: 100%;
padding: 10px;
cursor: pointer;
}

View File

@ -1,4 +1,12 @@
import {Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild} from '@angular/core'; import {
Component,
ElementRef,
EventEmitter,
Input,
OnInit,
Output,
ViewChild
} from '@angular/core';
import {Campaign} from '../../../models/model-interfaces'; import {Campaign} from '../../../models/model-interfaces';
import {LoginService} from '../../../services/app-user-service/login-service'; import {LoginService} from '../../../services/app-user-service/login-service';
import {Observable} from 'rxjs'; import {Observable} from 'rxjs';
@ -9,14 +17,12 @@ import {CampaignService} from '../../../services/logs/campaign.service';
templateUrl: './campaign-navigation.component.html', templateUrl: './campaign-navigation.component.html',
styleUrls: ['./campaign-navigation.component.scss'] styleUrls: ['./campaign-navigation.component.scss']
}) })
export class CampaignNavigationComponent implements OnInit, OnChanges { export class CampaignNavigationComponent implements OnInit {
campaigns$: Observable<Campaign[]>; campaigns$: Observable<Campaign[]>;
@Input() selectedCampaignId; @Input() selectedCampaignId;
@Input() isSmallLayout;
@Output() campaignSelect = new EventEmitter(); @Output() campaignSelect = new EventEmitter();
@Output() campaignEdit = new EventEmitter(); @Output() campaignEdit = new EventEmitter();
@ -25,8 +31,6 @@ export class CampaignNavigationComponent implements OnInit, OnChanges {
@ViewChild('horizontalList', {read: ElementRef}) public panel: ElementRef<any>; @ViewChild('horizontalList', {read: ElementRef}) public panel: ElementRef<any>;
selectedCampaign;
isLeftScrollVisible = false; isLeftScrollVisible = false;
isRightScrollVisible = true; isRightScrollVisible = true;
@ -44,18 +48,8 @@ export class CampaignNavigationComponent implements OnInit, OnChanges {
}); });
} }
ngOnChanges() {
this.campaigns$.subscribe(campaigns => {
const campaignIdx = campaigns.findIndex(c => c._id === this.selectedCampaignId);
if (campaignIdx !== -1) {
this.selectedCampaign = campaigns[campaignIdx];
}
});
}
select(campaign) { select(campaign) {
if (campaign && campaign._id) { if (campaign && campaign._id) {
this.selectedCampaign = campaign;
this.selectedCampaignId = campaign._id; this.selectedCampaignId = campaign._id;
this.campaignSelect.emit(campaign); this.campaignSelect.emit(campaign);
} }

View File

@ -14,7 +14,6 @@ h2 {
.search-field { .search-field {
width: 40%; width: 40%;
min-width: $highscore-table-width;
margin: 50px 0 50px 8%; margin: 50px 0 50px 8%;
} }

View File

@ -4,26 +4,21 @@
height: 650px; height: 650px;
margin: auto; margin: auto;
padding-left: 5%; padding-left: 5%;
}
@media all and (max-width: 959px) { @media all and (max-width: 959px) {
.slide-chart-container {
width: 100%; width: 100%;
min-width: unset; min-width: unset;
margin-top: 105px; padding-top: 105px;
margin-bottom: 35px; }
} }
.chart-select-group { .chart-select-group {
@media all and (max-width: 959px) {
display: inline-grid; display: inline-grid;
width: 70%; width: 70%;
text-align: center; text-align: center;
margin-left: 10%; margin-left: 10%;
} }
.chart-select-group /deep/ button.mat-button-toggle-button {
width: 100%;
}
} }
mat-button-toggle.mat-button-toggle-checked { mat-button-toggle.mat-button-toggle-checked {

View File

@ -1,22 +1,18 @@
<div>
<campaign-navigation <campaign-navigation
[selectedCampaignId]="selectedCampaign._id" [selectedCampaignId]="selectedCampaign._id"
[isSmallLayout]="isSmallLayout"
(campaignSelect)="switchCampaign($event)" (campaignSelect)="switchCampaign($event)"
(campaignEdit)="editCampaign($event)" (campaignEdit)="editCampaign($event)"
(campaignDelete)="deleteCampaign($event)"> (campaignDelete)="deleteCampaign($event)">
</campaign-navigation> </campaign-navigation>
</div>
<div [ngClass]="{collapsed: collapsed}" <div class="side-bar"
[style.display]="selectedCampaign._id === 'all' ? 'none' : 'block'" [ngClass]="{collapsed: collapsed}"
class="side-bar"> [style.display]="selectedCampaign._id === 'all' ? 'none' : 'block'">
<war-list <war-list
[collapsed]="collapsed" [collapsed]="collapsed"
[campaign]="selectedCampaign" [campaign]="selectedCampaign">
[isSmallLayout]="isSmallLayout">
</war-list> </war-list>
<div *ngIf="!isSmallLayout" class="button-container"> <div class="button-container" *ngIf="collapseBtnVisible">
<button mat-icon-button <button mat-icon-button
class="sidebar-toggle-btn" class="sidebar-toggle-btn"
(click)="toggleCollapse()"> (click)="toggleCollapse()">

View File

@ -1,10 +1,6 @@
.side-bar { .side-bar {
width: 20%; width: 20%;
float: left; float: left;
@media all and (max-width: 959px) {
width: 100%;
}
} }
.collapsed { .collapsed {
@ -14,8 +10,9 @@
.button-container { .button-container {
position: relative; position: relative;
z-index: 100; z-index: 100;
}
& > button { .button-container > button {
position: fixed; position: fixed;
top: calc(100vh - 35px); top: calc(100vh - 35px);
left: -10px; left: -10px;
@ -23,4 +20,3 @@
border: 1px solid #dadada; border: 1px solid #dadada;
box-shadow: #ffd740 0 0 3px; box-shadow: #ffd740 0 0 3px;
} }
}

View File

@ -21,7 +21,7 @@ export class StatisticComponent implements OnInit {
collapsed = false; collapsed = false;
isSmallLayout = false; collapseBtnVisible = true;
constructor(private campaignService: CampaignService, constructor(private campaignService: CampaignService,
private warService: WarService, private warService: WarService,
@ -40,9 +40,17 @@ export class StatisticComponent implements OnInit {
this.resolveCampaignFromUrl(); this.resolveCampaignFromUrl();
}); });
this.isSmallLayout = window.innerWidth <= BaseConfig.responsive.breakpointPx; if (window.innerWidth <= BaseConfig.responsive.breakpointPx) {
this.collapsed = true;
this.collapseBtnVisible = false;
}
Observable.fromEvent(window, 'resize').subscribe(event => { Observable.fromEvent(window, 'resize').subscribe(event => {
this.isSmallLayout = event.target['innerWidth'] <= BaseConfig.responsive.breakpointPx; if (event.target['innerWidth'] <= BaseConfig.responsive.breakpointPx) {
this.collapsed = true;
this.collapseBtnVisible = false;
} else {
this.collapseBtnVisible = true;
}
}); });
} }

View File

@ -7,10 +7,10 @@ import {NgxChartsModule} from '@swimlane/ngx-charts';
import {CampaignService} from '../services/logs/campaign.service'; import {CampaignService} from '../services/logs/campaign.service';
import {PlayerService} from '../services/logs/player.service'; import {PlayerService} from '../services/logs/player.service';
import {LogsService} from '../services/logs/logs.service'; import {LogsService} from '../services/logs/logs.service';
import {MatButtonToggleModule, MatListModule, MatMenuModule, MatSortModule, MatTableModule} from '@angular/material'; import {MatButtonToggleModule, MatMenuModule, MatSortModule, MatTableModule} from '@angular/material';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import {TranslateHttpLoader} from '@ngx-translate/http-loader'; import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {TranslateLoader, TranslateModule} from '@ngx-translate/core'; import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
export function createTranslateLoader(http: HttpClient) { export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/statistics/', '.json'); return new TranslateHttpLoader(http, './assets/i18n/statistics/', '.json');
@ -27,7 +27,6 @@ export function createTranslateLoader(http: HttpClient) {
MatTableModule, MatTableModule,
MatSortModule, MatSortModule,
MatMenuModule, MatMenuModule,
MatListModule,
statsRouterModule, statsRouterModule,
TranslateModule.forChild({ TranslateModule.forChild({

View File

@ -38,18 +38,3 @@
padding: 15px; padding: 15px;
float: left; float: left;
} }
@media all and (max-width: 959px) {
.chart-container {
width: 150%;
min-width: 0;
height: 70vh
}
.chart-select-group {
background: #dadada;
max-width: fit-content;
width: 200%;
flex-wrap: wrap;
}
}

View File

@ -20,8 +20,6 @@ export class FractionStatsComponent implements OnInit, OnChanges {
@Input() logData: any; @Input() logData: any;
@Input() isSmallLayout: boolean;
startDateObj: Date; startDateObj: Date;
initialized: any; initialized: any;

View File

@ -33,24 +33,8 @@
.mat-column-vehicleHeavy, .mat-column-vehicleAir, .mat-column-travelDistance, .mat-column-driverDistance, .mat-column-vehicleHeavy, .mat-column-vehicleAir, .mat-column-travelDistance, .mat-column-driverDistance,
.mat-column-death, .mat-column-respawn, .mat-column-interact { .mat-column-death, .mat-column-respawn, .mat-column-interact {
flex: 0 0 62px; flex: 0 0 62px;
@media all and (max-width: 959px) {
flex: 0 0 50px;
}
} }
:host /deep/ .mat-table .mat-icon { :host /deep/ .mat-table .mat-icon {
color: #666666; color: #666666;
} }
@media all and (max-width: 959px) {
.mat-column-name {
flex: 0 0 160px;
word-wrap: break-word;
white-space: pre-wrap;
}
.mat-header-row, .scoreboard-table {
width: 768px;
}
}

View File

@ -20,8 +20,6 @@ export class ScoreboardComponent implements OnChanges {
@Input() fractionFilterSelected: string; @Input() fractionFilterSelected: string;
@Input() isSmallLayout: boolean;
@Output() playerTabSwitch = new EventEmitter(); @Output() playerTabSwitch = new EventEmitter();
tableHead = PlayerUtils.attributeDisplayNames; tableHead = PlayerUtils.attributeDisplayNames;
@ -49,16 +47,8 @@ export class ScoreboardComponent implements OnChanges {
} }
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (changes['isSmallLayout'] && changes['isSmallLayout'].previousValue !== changes['isSmallLayout'].currentValue) {
const colIdxFraction = this.displayedColumns.findIndex(c => c === 'fraction');
if (this.isSmallLayout) {
this.displayedColumns.splice(colIdxFraction, 1);
} else if (colIdxFraction === -1) {
this.displayedColumns.splice(1, 0, 'fraction');
}
}
if (changes.war) { if (changes.war) {
changes.war.currentValue.players changes.war.currentValue.players
.filter(player => !player.initalized) .filter(player => !player.initalized)
.forEach(player => { .forEach(player => {

View File

@ -38,12 +38,3 @@
padding: 15px; padding: 15px;
float: left; float: left;
} }
@media all and (max-width: 959px) {
.chart-container {
width: 200%;
margin: 1%;
min-width: 0;
height: 80vh
}
}

View File

@ -9,7 +9,7 @@
style="font-weight: bold; margin-left: 10px;">{{war.ptOpfor}} {{fraction.OPFOR}}</span> style="font-weight: bold; margin-left: 10px;">{{war.ptOpfor}} {{fraction.OPFOR}}</span>
</div> </div>
<div class="pull-left head-field-pie-chart"> <div class="pull-left head-field " style="padding-left: 100px;">
<h4 class="pull-left" style="margin-bottom: 0;">{{'stats.scoreboard.participants' | translate}}</h4> <h4 class="pull-left" style="margin-bottom: 0;">{{'stats.scoreboard.participants' | translate}}</h4>
<ngx-charts-pie-chart <ngx-charts-pie-chart
class="pull-left" class="pull-left"
@ -24,7 +24,7 @@
</ngx-charts-pie-chart> </ngx-charts-pie-chart>
</div> </div>
<div class="btn-clean-log"> <div class="pull-left " style="padding-left: 100px; padding-top:15px">
<a class="btn btn-default" style="margin: 20px" target="_blank" href="resource/logs/{{war._id}}/clean.log"> <a class="btn btn-default" style="margin: 20px" target="_blank" href="resource/logs/{{war._id}}/clean.log">
{{'stats.scoreboard.show.logs' | translate}} {{'stats.scoreboard.show.logs' | translate}}
</a> </a>
@ -83,9 +83,7 @@
{{fraction.OPFOR}} {{fraction.OPFOR}}
</label> </label>
</form> </form>
<span class="btn btn-default pull-left tab-control" <span class="btn btn-default pull-left tab-control" (click)="scoreBoardComponent.exportCSV()">
*ngIf="!isSmallLayout"
(click)="scoreBoardComponent.exportCSV()">
{{'stats.scoreboard.download.csv' | translate}} {{'stats.scoreboard.download.csv' | translate}}
</span> </span>
</div> </div>
@ -99,14 +97,12 @@
#scoreboard #scoreboard
[war]="war" [war]="war"
[fractionFilterSelected]="fractionFilterSelected" [fractionFilterSelected]="fractionFilterSelected"
[isSmallLayout]="isSmallLayout"
(playerTabSwitch)="switchToPlayerTab($event)"> (playerTabSwitch)="switchToPlayerTab($event)">
</cc-scoreboard> </cc-scoreboard>
<war-detail-fraction <war-detail-fraction
*ngIf="tab === 1 && logData" *ngIf="tab === 1 && logData"
[war]="war" [war]="war"
[logData]="logData" [logData]="logData">
[isSmallLayout]="isSmallLayout">
</war-detail-fraction> </war-detail-fraction>
<campaign-player-detail <campaign-player-detail
*ngIf="tab === 2 && singlePlayerView === 1" *ngIf="tab === 2 && singlePlayerView === 1"

View File

@ -1,10 +1,6 @@
@import url('../../../style/list-entry.scss'); @import url('../../../style/list-entry.scss');
@import url('../../../style/hide-scrollbar.scss'); @import url('../../../style/hide-scrollbar.scss');
.war-header {
padding-left: 1.5vw;
}
.war-header-container { .war-header-container {
width: 920px; width: 920px;
min-height: 165px; min-height: 165px;
@ -18,11 +14,6 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
.head-field-pie-chart {
@extend .head-field;
padding-left: 100px;
}
form.tab-control { form.tab-control {
padding: 10px; padding: 10px;
} }
@ -89,33 +80,3 @@ span.tab-control {
cursor: pointer !important; cursor: pointer !important;
color: #666666 !important; color: #666666 !important;
} }
.btn-clean-log {
padding-left: 100px;
padding-top: 15px;
float: left;
}
@media all and (max-width: 959px) {
.war-header {
position: relative;
overflow: auto;
margin-bottom: 34px; /*do not cover anything with back to top bar*/
}
.war-header-container, .nav-tabs {
width: 768px;
}
.head-field-pie-chart {
padding-left: 0;
}
.nav-tabs > li:last-child {
margin-left: 25px;
}
div.btn-clean-log {
padding-left: 57px;
}
}

View File

@ -6,8 +6,6 @@ import {ChartUtils} from '../../../utils/chart-utils';
import {Fraction} from '../../../utils/fraction.enum'; import {Fraction} from '../../../utils/fraction.enum';
import {LogsService} from '../../../services/logs/logs.service'; import {LogsService} from '../../../services/logs/logs.service';
import {ScoreboardComponent} from '../scoreboard/scoreboard.component'; import {ScoreboardComponent} from '../scoreboard/scoreboard.component';
import {BaseConfig} from '../../../app.config';
import {Observable} from 'rxjs';
@Component({ @Component({
@ -39,8 +37,6 @@ export class WarHeaderComponent implements OnInit {
fractionFilterSelected: string; fractionFilterSelected: string;
isSmallLayout = false;
playerChart: any[] = []; playerChart: any[] = [];
colorScheme = { colorScheme = {
@ -68,11 +64,6 @@ export class WarHeaderComponent implements OnInit {
ChartUtils.getSingleDataArray(Fraction.OPFOR, war.playersOpfor, Fraction.BLUFOR, war.playersBlufor); ChartUtils.getSingleDataArray(Fraction.OPFOR, war.playersOpfor, Fraction.BLUFOR, war.playersBlufor);
Object.assign(this, [this.playerChart]); Object.assign(this, [this.playerChart]);
}); });
this.isSmallLayout = window.innerWidth <= BaseConfig.responsive.breakpointPx;
Observable.fromEvent(window, 'resize').subscribe(event => {
this.isSmallLayout = event.target['innerWidth'] <= BaseConfig.responsive.breakpointPx;
});
} }
switchTab(index: number) { switchTab(index: number) {

View File

@ -1,4 +1,3 @@
<div *ngIf="!isSmallLayout">
<div class="war-list-header" *ngIf="!collapsed && loginService.hasPermission(3)"> <div class="war-list-header" *ngIf="!collapsed && loginService.hasPermission(3)">
<button mat-stroked-button (click)="selectNewCampaign()"> <button mat-stroked-button (click)="selectNewCampaign()">
{{'stats.sidebar.campaign.add' | translate}} {{'stats.sidebar.campaign.add' | translate}}
@ -52,28 +51,3 @@
[ngClass]="{collapsed: collapsed}"> [ngClass]="{collapsed: collapsed}">
</div> </div>
</div> </div>
</div>
<div class="war-select-small" *ngIf="isSmallLayout">
<mat-list-item [matMenuTriggerFor]="menuWars">
<div matline class="select-menu-text">
<span *ngIf="selectedWarId === (campaign._id + highscore)">{{'stats.sidebar.highscore' | translate}}</span>
<span *ngIf="selectedWarId === campaign._id">{{'stats.sidebar.overview' | translate}}</span>
<span *ngIf="selectedWar">{{selectedWar.title}}</span>
<span class="caret"></span>
</div>
</mat-list-item>
<mat-menu #menuWars="matMenu">
<button mat-menu-item (click)="selectOverview(campaign._id)">
{{'stats.sidebar.overview' | translate}}
</button>
<button mat-menu-item (click)="selectHighscore(campaign._id)">
{{'stats.sidebar.highscore' | translate}}
</button>
<mat-divider></mat-divider>
<button mat-menu-item *ngFor="let war of campaign.wars$ | async"
(click)="selectWar(war._id)">
{{war.title}}
</button>
</mat-menu>
</div>

View File

@ -98,24 +98,6 @@
} }
} }
.war-select-small {
background: #424242;
height: 3em;
color: #9d9d9d;
text-align: center;
.select-menu-text {
font-size: 16px;
}
}
:host /deep/ div.mat-list-item-content {
height: 100%;
padding: 10px;
cursor: pointer;
}
/* Table Scrollbar BEGIN */ /* Table Scrollbar BEGIN */
.battle-list::-webkit-scrollbar { .battle-list::-webkit-scrollbar {

View File

@ -18,12 +18,8 @@ export class WarListComponent implements OnChanges {
@Input() collapsed: boolean; @Input() collapsed: boolean;
@Input() isSmallLayout: boolean;
selectedWarId: string | number; selectedWarId: string | number;
selectedWar: War;
changeCount = 0; changeCount = 0;
toolTipTranslation = {}; toolTipTranslation = {};
@ -69,30 +65,15 @@ export class WarListComponent implements OnChanges {
} else if (changes.campaign) { } else if (changes.campaign) {
this.selectOverview(this.campaign._id); this.selectOverview(this.campaign._id);
} }
this.fetchSelectedWar(this.selectedWarId);
}
fetchSelectedWar(newSelect) {
this.campaign.wars$.subscribe(wars => {
const warIdx = wars.findIndex(w => w._id === newSelect);
if (warIdx !== -1) {
this.selectedWar = wars[warIdx];
} else {
this.selectedWar = null;
}
});
} }
selectNewCampaign() { selectNewCampaign() {
this.selectedWarId = null; this.selectedWarId = null;
this.selectedWar = null;
this.router.navigate([{outlets: {'right': ['campaign']}}], {relativeTo: this.route}); this.router.navigate([{outlets: {'right': ['campaign']}}], {relativeTo: this.route});
} }
selectWar(warId) { selectWar(warId) {
if (this.selectedWarId !== warId) { if (this.selectedWarId !== warId) {
this.fetchSelectedWar(warId);
this.selectedWarId = warId; this.selectedWarId = warId;
this.router.navigate([{outlets: {'right': ['war', warId]}}], {relativeTo: this.route}); this.router.navigate([{outlets: {'right': ['war', warId]}}], {relativeTo: this.route});
} }
@ -101,7 +82,6 @@ export class WarListComponent implements OnChanges {
selectOverview(campaignId) { selectOverview(campaignId) {
if (this.selectedWarId !== campaignId) { if (this.selectedWarId !== campaignId) {
this.selectedWarId = campaignId; this.selectedWarId = campaignId;
this.selectedWar = null;
this.router.navigate([{outlets: {'right': ['overview', campaignId]}}], {relativeTo: this.route}); this.router.navigate([{outlets: {'right': ['overview', campaignId]}}], {relativeTo: this.route});
} }
} }
@ -109,7 +89,6 @@ export class WarListComponent implements OnChanges {
selectHighscore(campaignId) { selectHighscore(campaignId) {
if (this.selectedWarId !== campaignId + this.highscore) { if (this.selectedWarId !== campaignId + this.highscore) {
this.selectedWarId = campaignId + this.highscore; this.selectedWarId = campaignId + this.highscore;
this.selectedWar = null;
this.router.navigate([{outlets: {'right': ['highscore', campaignId]}}], {relativeTo: this.route}); this.router.navigate([{outlets: {'right': ['highscore', campaignId]}}], {relativeTo: this.route});
} }
} }