From 24f6b2a1563d491355fb52913ab0afea21feff7e Mon Sep 17 00:00:00 2001 From: HardiReady Date: Mon, 30 Jul 2018 20:43:47 +0200 Subject: [PATCH] Add stats list sidebar collapse --- static/src/app/statistic/stats.component.css | 21 +++++++++++++ static/src/app/statistic/stats.component.html | 22 +++++++------ static/src/app/statistic/stats.component.ts | 9 ++++++ .../war/war-list/war-item.component.css | 4 +++ .../war/war-list/war-item.component.html | 11 +++++-- .../war/war-list/war-item.component.ts | 2 ++ .../war/war-list/war-list.component.css | 17 +++++++--- .../war/war-list/war-list.component.html | 31 +++++++++++++------ .../war/war-list/war-list.component.ts | 4 ++- 9 files changed, 95 insertions(+), 26 deletions(-) diff --git a/static/src/app/statistic/stats.component.css b/static/src/app/statistic/stats.component.css index e69de29..f6990b2 100644 --- a/static/src/app/statistic/stats.component.css +++ b/static/src/app/statistic/stats.component.css @@ -0,0 +1,21 @@ +.side-bar { + width: 20%; + float: left; +} + +.collapsed { + width: 70px; +} + +.button-container { + position: relative; + z-index: 100; +} + +.button-container > button { + position: fixed; + top: calc(100vh - 35px); + left: -10px; + background: white; + border: 1px solid #dadada; +} diff --git a/static/src/app/statistic/stats.component.html b/static/src/app/statistic/stats.component.html index b72ec53..0d2a08d 100644 --- a/static/src/app/statistic/stats.component.html +++ b/static/src/app/statistic/stats.component.html @@ -5,18 +5,22 @@
- - - - - - - - + class="side-bar" + [ngClass]="{collapsed: collapsed}"> +
+ +
diff --git a/static/src/app/statistic/stats.component.ts b/static/src/app/statistic/stats.component.ts index c1a6bed..184e46e 100644 --- a/static/src/app/statistic/stats.component.ts +++ b/static/src/app/statistic/stats.component.ts @@ -14,6 +14,8 @@ export class StatisticComponent implements OnInit { campaigns: Campaign[] = []; + collapsed: boolean = false; + constructor(private campaignService: CampaignService, private router: Router, private route: ActivatedRoute) { @@ -36,4 +38,11 @@ export class StatisticComponent implements OnInit { } this.router.navigate([{outlets: {'right': ['overview', campaign._id]}}], {relativeTo: this.route}); } + + toggleCollapse() { + this.collapsed = !this.collapsed; + setTimeout(_ => { + window.dispatchEvent(new Event('resize')); + }); + } } diff --git a/static/src/app/statistic/war/war-list/war-item.component.css b/static/src/app/statistic/war/war-list/war-item.component.css index aaec2d6..3c5b7b5 100644 --- a/static/src/app/statistic/war/war-list/war-item.component.css +++ b/static/src/app/statistic/war/war-list/war-item.component.css @@ -40,3 +40,7 @@ .selected div.select-indicator-battle { display: block !important; } + +.collapsed { + white-space: nowrap; +} diff --git a/static/src/app/statistic/war/war-list/war-item.component.html b/static/src/app/statistic/war/war-list/war-item.component.html index 6654d9f..f13e49f 100644 --- a/static/src/app/statistic/war/war-list/war-item.component.html +++ b/static/src/app/statistic/war/war-list/war-item.component.html @@ -1,12 +1,17 @@
-
+
- + ◦ {{war.title}} -
vom {{war.date | date: 'dd.MM.yyyy'}}
+
vom {{war.date | date: 'dd.MM.yyyy'}} +
div.select-indicator { +.selected > div.select-indicator-container { display: block !important; } @@ -66,7 +71,7 @@ .fill-vertical-border { width: 20%; position: fixed; - border-right: 1px solid #dadada; + border-right: 1px solid #dadada; height: 100vh; } @@ -85,3 +90,7 @@ } /* Table Scrollbar END */ + +.collapsed { + width: 70px; +} diff --git a/static/src/app/statistic/war/war-list/war-list.component.html b/static/src/app/statistic/war/war-list/war-list.component.html index 4200a54..9ae2e13 100644 --- a/static/src/app/statistic/war/war-list/war-list.component.html +++ b/static/src/app/statistic/war/war-list/war-list.component.html @@ -10,21 +10,31 @@
-
- - Übersicht +
+
+
+ + Übersicht
-
- - Highscore +
+
+
+ + Highscore
- - Schlachten + + Schlachten
@@ -34,9 +44,12 @@ (warEdit)="editWar($event)" (warDelete)="deleteWar(war)" (warSelected)="selectWar($event)" + [collapsed]="collapsed" [selected]="war._id == selectedWarId">
-
+
+
diff --git a/static/src/app/statistic/war/war-list/war-list.component.ts b/static/src/app/statistic/war/war-list/war-list.component.ts index a5f953a..88c3195 100644 --- a/static/src/app/statistic/war/war-list/war-list.component.ts +++ b/static/src/app/statistic/war/war-list/war-list.component.ts @@ -15,6 +15,8 @@ export class WarListComponent implements OnInit, OnChanges { @Input() campaign: Campaign; + @Input() collapsed: boolean; + selectedWarId: string | number; campaigns: Campaign[] = []; @@ -29,7 +31,7 @@ export class WarListComponent implements OnInit, OnChanges { } ngOnChanges(changes: SimpleChanges) { - this.selectedWarId = this.campaign._id; + if (changes.campaign) this.selectedWarId = this.campaign._id; } ngOnInit() {