Commit ab00dfc2 authored by Dennis Willers's avatar Dennis Willers 🏀

Change Screen Resolution / Fix Button Spam Bug

parent fe09725b
...@@ -11,6 +11,13 @@ html, body { ...@@ -11,6 +11,13 @@ html, body {
margin-top: 5em; margin-top: 5em;
} }
.tabletView {
text-align: center;
margin-left: 5em;
margin-right: 5em;
margin-top: 5em;
}
.mobileView { .mobileView {
text-align: center; text-align: center;
margin-left: 2em; margin-left: 2em;
......
import {Component, OnInit} from '@angular/core'; import {Component, HostListener, OnInit} from '@angular/core';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
...@@ -8,12 +8,24 @@ import {Component, OnInit} from '@angular/core'; ...@@ -8,12 +8,24 @@ import {Component, OnInit} from '@angular/core';
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
title = 'Tabu'; title = 'Tabu';
view = 'desktopView'; view = 'desktopView';
isMobileResolution = false;
ngOnInit(): void { ngOnInit(): void {
this.isMobileResolution = window.innerWidth < 768; const width = window.innerWidth;
if (this.isMobileResolution) { this.setView(width);
}
@HostListener('window:resize', ['$event'])
onResize($event: any): any {
console.log('RESIZE');
const width = window.innerWidth;
this.setView(width);
}
setView(width: number): void {
if (width < 768) {
this.view = 'mobileView'; this.view = 'mobileView';
} else if (width < 1024){
this.view = 'tabletView';
} else { } else {
this.view = 'desktopView'; this.view = 'desktopView';
} }
......
...@@ -144,9 +144,12 @@ export class GameComponent implements OnInit, OnDestroy { ...@@ -144,9 +144,12 @@ export class GameComponent implements OnInit, OnDestroy {
({ ({
spielname: this.sessionName, team: this.team, red: this.gameStatus.red, blue: this.gameStatus.blue, cardID: this.gameStatus.activeCard spielname: this.sessionName, team: this.team, red: this.gameStatus.red, blue: this.gameStatus.blue, cardID: this.gameStatus.activeCard
}).then(value => { }).then(value => {
this.newCard(); const status = JSON.parse(value.status);
this.gameStatus.red = JSON.parse(value.red); if (status) {
this.gameStatus.blue = JSON.parse(value.blue); this.newCard();
this.gameStatus.red = JSON.parse(value.red);
this.gameStatus.blue = JSON.parse(value.blue);
}
}); });
} }
...@@ -160,9 +163,12 @@ export class GameComponent implements OnInit, OnDestroy { ...@@ -160,9 +163,12 @@ export class GameComponent implements OnInit, OnDestroy {
blue: this.gameStatus.blue, blue: this.gameStatus.blue,
cardID: this.gameStatus.activeCard cardID: this.gameStatus.activeCard
}).then(value => { }).then(value => {
this.newCard(); const status = JSON.parse(value.status);
this.gameStatus.red = JSON.parse(value.red); if (status) {
this.gameStatus.blue = JSON.parse(value.blue); this.newCard();
this.gameStatus.red = JSON.parse(value.red);
this.gameStatus.blue = JSON.parse(value.blue);
}
}); });
} else if (this.isWatchdog) { } else if (this.isWatchdog) {
let opennentTeam = ''; let opennentTeam = '';
...@@ -179,9 +185,12 @@ export class GameComponent implements OnInit, OnDestroy { ...@@ -179,9 +185,12 @@ export class GameComponent implements OnInit, OnDestroy {
blue: this.gameStatus.blue, blue: this.gameStatus.blue,
cardID: this.gameStatus.activeCard cardID: this.gameStatus.activeCard
}).then(value => { }).then(value => {
this.newCard(); const status = JSON.parse(value.status);
this.gameStatus.red = JSON.parse(value.red); if (status) {
this.gameStatus.blue = JSON.parse(value.blue); this.newCard();
this.gameStatus.red = JSON.parse(value.red);
this.gameStatus.blue = JSON.parse(value.blue);
}
}); });
} }
} }
......
<mat-card *ngIf="round !== 0" class="transparent {{redTurn}}"> <mat-card *ngIf="roundHistory.length > 0" class="transparent {{redTurn}}">
<mat-card-title>Runde {{round}}</mat-card-title> <mat-card-title>Runde {{round}}</mat-card-title>
</mat-card> </mat-card>
<div class="example-container mat-elevation-z8"> <div class="example-container mat-elevation-z8">
......
...@@ -73,9 +73,6 @@ export class RoundHistoryComponent extends DataSource<any> implements OnInit, On ...@@ -73,9 +73,6 @@ export class RoundHistoryComponent extends DataSource<any> implements OnInit, On
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (this.round === 6) {
console.log(changes);
}
if (changes.hasOwnProperty('round')) { if (changes.hasOwnProperty('round')) {
this.round = changes.round.currentValue; this.round = changes.round.currentValue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment