Commit ab00dfc2 authored by Dennis Willers's avatar Dennis Willers
Browse files

Change Screen Resolution / Fix Button Spam Bug

parent fe09725b
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -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;
+16 −4
Original line number Original line Diff line number Diff line
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';
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';
    }
    }
+9 −0
Original line number Original line Diff line number Diff line
@@ -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 => {
      const status = JSON.parse(value.status);
      if (status) {
        this.newCard();
        this.newCard();
        this.gameStatus.red = JSON.parse(value.red);
        this.gameStatus.red = JSON.parse(value.red);
        this.gameStatus.blue = JSON.parse(value.blue);
        this.gameStatus.blue = JSON.parse(value.blue);
      }
    });
    });
  }
  }


@@ -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 => {
        const status = JSON.parse(value.status);
        if (status) {
          this.newCard();
          this.newCard();
          this.gameStatus.red = JSON.parse(value.red);
          this.gameStatus.red = JSON.parse(value.red);
          this.gameStatus.blue = JSON.parse(value.blue);
          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 {
        blue: this.gameStatus.blue,
        blue: this.gameStatus.blue,
        cardID: this.gameStatus.activeCard
        cardID: this.gameStatus.activeCard
      }).then(value => {
      }).then(value => {
        const status = JSON.parse(value.status);
        if (status) {
          this.newCard();
          this.newCard();
          this.gameStatus.red = JSON.parse(value.red);
          this.gameStatus.red = JSON.parse(value.red);
          this.gameStatus.blue = JSON.parse(value.blue);
          this.gameStatus.blue = JSON.parse(value.blue);
        }
      });
      });
    }
    }
  }
  }
+1 −1
Original line number Original line Diff line number Diff line
<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">
+0 −3
Original line number Original line Diff line number Diff line
@@ -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;
    }
    }