Commit 046a4c10 authored by Dennis Willers's avatar Dennis Willers 🏀

Change Screen Resolution / Fix Button Spam Bug

parent 1fbeaaf8
Pipeline #382 passed with stages
in 5 minutes and 41 seconds
import {Component, HostListener, OnInit} from '@angular/core'; import {Component, HostListener, OnInit} from '@angular/core';
import {ViewModus} from './dao/viewModus';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
...@@ -14,9 +15,10 @@ export class AppComponent implements OnInit { ...@@ -14,9 +15,10 @@ export class AppComponent implements OnInit {
this.setView(width); this.setView(width);
} }
constructor(private screen: ViewModus){}
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])
onResize($event: any): any { onResize($event: any): any {
console.log('RESIZE');
const width = window.innerWidth; const width = window.innerWidth;
this.setView(width); this.setView(width);
} }
...@@ -29,5 +31,6 @@ export class AppComponent implements OnInit { ...@@ -29,5 +31,6 @@ export class AppComponent implements OnInit {
} else { } else {
this.view = 'desktopView'; this.view = 'desktopView';
} }
this.screen.setNewView(this.view);
} }
} }
...@@ -30,6 +30,7 @@ import { RulesComponent } from './rules/rules.component'; ...@@ -30,6 +30,7 @@ import { RulesComponent } from './rules/rules.component';
import { RoundHistoryComponent } from './round-history/round-history.component'; import { RoundHistoryComponent } from './round-history/round-history.component';
import {MatTableModule} from '@angular/material/table'; import {MatTableModule} from '@angular/material/table';
import {MatTreeModule} from '@angular/material/tree'; import {MatTreeModule} from '@angular/material/tree';
import {ViewModus} from './dao/viewModus';
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -66,7 +67,8 @@ import {MatTreeModule} from '@angular/material/tree'; ...@@ -66,7 +67,8 @@ import {MatTreeModule} from '@angular/material/tree';
], ],
providers: [ providers: [
IsAllowedToPlay, IsAllowedToPlay,
SocketDataService SocketDataService,
ViewModus
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
......
import {Injectable} from '@angular/core';
import {Subject} from 'rxjs';
@Injectable()
export class ViewModus {
actuallView = 'desktopView';
view = new Subject<string>();
$view = this.view.asObservable();
setNewView(view: string): void {
this.view.next(view);
this.actuallView = view;
}
}
<div *ngIf="isMobileResolution" style="margin-top: -4.25em;"> <div *ngIf="view !== 'desktopView'" style="margin-top: -4.25em;">
<mat-progress-spinner style="border-radius: 50%;" class = "center" color="primary" mode="determinate" value={{timeLeft}} aria-label="Rating"> <mat-progress-spinner style="border-radius: 50%;" class = "center white transparent" color="primary" mode="determinate" value={{timeLeft}} aria-label="Rating">
</mat-progress-spinner> </mat-progress-spinner>
<mat-card-content class = "timer">{{timeRemaining}}</mat-card-content> <mat-card-content class = "timer">{{timeRemaining}}</mat-card-content>
<br> <br>
</div> </div>
<div *ngIf="!isMobileResolution" class="TimerLeft" style="margin-top: -4.25em; margin-right: -11.5em; margin-left: auto"> <div *ngIf="view === 'desktopView'" class="TimerLeft" style="margin-top: -4.25em; margin-right: -11.5em; margin-left: auto">
<mat-progress-spinner style="border-radius: 50%;" class = "white" color="primary" mode="determinate" value={{timeLeft}} aria-label="Rating"> <mat-progress-spinner style="border-radius: 50%;" class = "white transparent" color="primary" mode="determinate" value={{timeLeft}} aria-label="Rating">
</mat-progress-spinner> </mat-progress-spinner>
<mat-card-content class = "timer">{{timeRemaining}}</mat-card-content> <mat-card-content class = "timer">{{timeRemaining}}</mat-card-content>
</div> </div>
...@@ -44,9 +43,12 @@ ...@@ -44,9 +43,12 @@
</h2> </h2>
</mat-card> </mat-card>
<br> <br>
<button *ngIf="isExplainer" class="marginButton" mat-raised-button color="primary" (click)="rightAnswer()">Richtig &#10004;</button> <div class="marginButtons">
<button *ngIf="isExplainer" class="marginButton"mat-raised-button color="accent" (click)="skipCard()">Überspringen &#187;</button> <button class="marginButtonRight" *ngIf="isExplainer" mat-raised-button color="primary" (click)="rightAnswer()">Richtig &#10004;</button>
<button mat-raised-button class="marginButton"color="warn" [disabled]="PressTaboohDisabled" (click)="wrongAnswer()">Tabooh &#10008;</button> <button class="marginButtonLeft marginButtonRight" *ngIf="isExplainer" mat-raised-button color="accent" (click)="skipCard()">Überspringen &#187;</button>
<a *ngIf="!isExplainer" class="marginButtonRight"></a>
<button class="marginButtonLeft" mat-raised-button color="warn" [disabled]="PressTaboohDisabled" (click)="wrongAnswer()">Tabooh &#10008;</button>
</div>
<br> <br>
<br> <br>
<mat-card class="transparent"> <mat-card class="transparent">
......
...@@ -14,7 +14,6 @@ th{ ...@@ -14,7 +14,6 @@ th{
.white{ .white{
background-color: white; background-color: white;
} }
.timer{ .timer{
...@@ -51,8 +50,17 @@ body { ...@@ -51,8 +50,17 @@ body {
margin-right: auto; margin-right: auto;
} }
.marginButton { .marginButtonRight {
margin-right: 10px; margin-right: clamp(7px, 2%, 25px);
margin-left: 10px; }
.marginButtonLeft {
margin-left: clamp(7px, 2%, 25px);
} }
.marginButtons {
display: flex;
justify-content: center;
}
...@@ -7,6 +7,7 @@ import {IsAllowedToPlay} from '../dao/isAllowedToPlay'; ...@@ -7,6 +7,7 @@ import {IsAllowedToPlay} from '../dao/isAllowedToPlay';
import {SocketDataService} from '../dao/socketDataService'; import {SocketDataService} from '../dao/socketDataService';
import {Subject} from 'rxjs'; import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators'; import {takeUntil} from 'rxjs/operators';
import {ViewModus} from '../dao/viewModus';
@Component({ @Component({
selector: 'app-game', selector: 'app-game',
...@@ -14,8 +15,7 @@ import {takeUntil} from 'rxjs/operators'; ...@@ -14,8 +15,7 @@ import {takeUntil} from 'rxjs/operators';
styleUrls: ['./game.component.scss'] styleUrls: ['./game.component.scss']
}) })
export class GameComponent implements OnInit, OnDestroy { export class GameComponent implements OnInit, OnDestroy {
isMobileResolution = false; view = 'desktopView';
private ngUnsubscribe = new Subject(); private ngUnsubscribe = new Subject();
subNewCard: any; subNewCard: any;
subEndRound: any; subEndRound: any;
...@@ -60,11 +60,16 @@ export class GameComponent implements OnInit, OnDestroy { ...@@ -60,11 +60,16 @@ export class GameComponent implements OnInit, OnDestroy {
private router: Router, private router: Router,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private isAllowedToPlay: IsAllowedToPlay, private isAllowedToPlay: IsAllowedToPlay,
private socketDataService: SocketDataService) { private socketDataService: SocketDataService,
private screen: ViewModus) {
screen.$view.subscribe(
view => {
this.view = view;
});
} }
ngOnInit(): void { ngOnInit(): void {
this.isMobileResolution = window.innerWidth < 768; this.view = this.screen.actuallView;
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
this.sessionName = String(params.get('sessionName')).toLowerCase(); this.sessionName = String(params.get('sessionName')).toLowerCase();
this.team = String(params.get('team')); this.team = String(params.get('team'));
...@@ -128,7 +133,7 @@ export class GameComponent implements OnInit, OnDestroy { ...@@ -128,7 +133,7 @@ export class GameComponent implements OnInit, OnDestroy {
this.timePassed = this.timePassed += 1; this.timePassed = this.timePassed += 1;
this.timeLeft = (this.TIME_LIMIT - this.timePassed); this.timeLeft = (this.TIME_LIMIT - this.timePassed);
if (this.timeLeft === 0) { if (this.timeLeft === 0) {
//this.onTimesUp(); // this.onTimesUp();
} }
}, 593); }, 593);
} }
......
...@@ -17,12 +17,19 @@ ...@@ -17,12 +17,19 @@
<mat-card class="transparent"> <mat-card class="transparent">
<div class="FloatLeftAndCenterElement"> <div class="FloatLeftAndCenterElement">
<div class="newStartButtonLeft"> <div *ngIf="view === 'mobileView'" class="textMobileView">
<button matTooltip="Neues Spiel starten" [disabled]="buttonNewGameDisabled || gameStatus.activeExplainer == 1" mat-raised-button color="primary" (click)="startGame()"> <button matTooltip="Neues Spiel starten" [disabled]="buttonNewGameDisabled || gameStatus.activeExplainer == 1" mat-raised-button color="primary" (click)="startGame()">
<mat-icon color = "white" aria-hidden="false">autorenew</mat-icon></button> <mat-icon color = "white" aria-hidden="false">autorenew</mat-icon>
</button>
</div>
<div *ngIf="view !== 'mobileView'" class="newStartButtonLeft">
<button matTooltip="Neues Spiel starten" [disabled]="buttonNewGameDisabled || gameStatus.activeExplainer == 1" mat-raised-button color="primary" (click)="startGame()">
<mat-icon color = "white" aria-hidden="false">autorenew</mat-icon>
</button>
</div> </div>
<div class="CenterText"> <div class="CenterText">
<h2>{{membership}}</h2> <h2 *ngIf="view === 'mobileView'" class="textMobileView">{{membership}}</h2>
<h2 *ngIf="view !== 'mobileView'">{{membership}}</h2>
</div> </div>
</div> </div>
<button mat-raised-button class = "{{red}}" (click)="joinTeam('red')"> <button mat-raised-button class = "{{red}}" (click)="joinTeam('red')">
......
...@@ -58,3 +58,7 @@ th{ ...@@ -58,3 +58,7 @@ th{
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
} }
.textMobileView {
display: inline;
}
import {Component, HostListener, OnDestroy, OnInit} from '@angular/core'; import {Component, HostListener, Input, OnChanges, OnDestroy, OnInit, SimpleChanges} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService';
import {GameStatus} from '../interface/gameStatus'; import {GameStatus} from '../interface/gameStatus';
...@@ -6,6 +6,7 @@ import {IsAllowedToPlay} from '../dao/isAllowedToPlay'; ...@@ -6,6 +6,7 @@ import {IsAllowedToPlay} from '../dao/isAllowedToPlay';
import {SocketDataService} from '../dao/socketDataService'; import {SocketDataService} from '../dao/socketDataService';
import {Subject} from 'rxjs'; import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators'; import {takeUntil} from 'rxjs/operators';
import {ViewModus} from '../dao/viewModus';
@Component({ @Component({
selector: 'app-overview', selector: 'app-overview',
...@@ -13,7 +14,7 @@ import {takeUntil} from 'rxjs/operators'; ...@@ -13,7 +14,7 @@ import {takeUntil} from 'rxjs/operators';
styleUrls: ['./overview.component.scss'] styleUrls: ['./overview.component.scss']
}) })
export class OverviewComponent implements OnInit, OnDestroy { export class OverviewComponent implements OnInit, OnDestroy {
view = 'desktopView';
private ngUnsubscribe = new Subject(); private ngUnsubscribe = new Subject();
subNewGame: any; subNewGame: any;
subNewCard: any; subNewCard: any;
...@@ -50,9 +51,16 @@ export class OverviewComponent implements OnInit, OnDestroy { ...@@ -50,9 +51,16 @@ export class OverviewComponent implements OnInit, OnDestroy {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private service: TabuMiddlewareService, private service: TabuMiddlewareService,
private isAllowedToPlay: IsAllowedToPlay, private isAllowedToPlay: IsAllowedToPlay,
private socketDataService: SocketDataService) { } private socketDataService: SocketDataService,
private screen: ViewModus) {
screen.$view.subscribe(
view => {
this.view = view;
});
}
ngOnInit(): void { ngOnInit(): void {
this.view = this.screen.actuallView;
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
this.sessionName = String(params.get('sessionName')).toLowerCase(); this.sessionName = String(params.get('sessionName')).toLowerCase();
this.team = String(params.get('team')); this.team = String(params.get('team'));
...@@ -93,9 +101,7 @@ export class OverviewComponent implements OnInit, OnDestroy { ...@@ -93,9 +101,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
getSocketData(): void { getSocketData(): void {
this.subHistoryChanged = this.socketDataService.getHistoryChangedInfo (this.sessionName) this.subHistoryChanged = this.socketDataService.getHistoryChangedInfo (this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe)).subscribe( data => { .pipe(takeUntil(this.ngUnsubscribe)).subscribe( data => {
console.log('WANT UPDATE: ', this.canUpdateHistory);
if (this.canUpdateHistory) { if (this.canUpdateHistory) {
console.log('UPDATE HISTORY');
this.getGameStatus(); this.getGameStatus();
} }
}); });
...@@ -105,7 +111,6 @@ export class OverviewComponent implements OnInit, OnDestroy { ...@@ -105,7 +111,6 @@ export class OverviewComponent implements OnInit, OnDestroy {
}); });
this.subNewCard = this.socketDataService.getNewCard(this.sessionName) this.subNewCard = this.socketDataService.getNewCard(this.sessionName)
.pipe(takeUntil(this.ngUnsubscribe)).subscribe(data => { .pipe(takeUntil(this.ngUnsubscribe)).subscribe(data => {
console.log('UPDATE CARD');
this.getGameStatus(); this.getGameStatus();
}); });
this.subEndRound = this.socketDataService.getEndRound(this.sessionName) this.subEndRound = this.socketDataService.getEndRound(this.sessionName)
......
...@@ -17,7 +17,10 @@ ...@@ -17,7 +17,10 @@
</ng-container> </ng-container>
<!-- Solution Column --> <!-- Solution Column -->
<ng-container matColumnDef="solution"> <ng-container *ngIf="view === 'mobileView'" matColumnDef="solution">
<mat-cell *matCellDef="let element" class="marginButtons"> <b *ngIf="element.answer !== answer.zeitLaueft">{{element.solution}}</b></mat-cell>
</ng-container>
<ng-container *ngIf="view !== 'mobileView'" matColumnDef="solution">
<mat-cell *matCellDef="let element"> <b *ngIf="element.answer !== answer.zeitLaueft">{{element.solution}}</b></mat-cell> <mat-cell *matCellDef="let element"> <b *ngIf="element.answer !== answer.zeitLaueft">{{element.solution}}</b></mat-cell>
</ng-container> </ng-container>
...@@ -47,12 +50,102 @@ ...@@ -47,12 +50,102 @@
</ng-container> </ng-container>
<!-- Expanded Content Column - The detail row is made up of this one column --> <!-- Expanded Content Column - The detail row is made up of this one column -->
<ng-container matColumnDef="expandedDetail" class="volleBreite"> <ng-container *ngIf="view === 'mobileView'" matColumnDef="expandedDetail">
<mat-cell *matCellDef="let detail" class="expandStyle"> <mat-cell *matCellDef="let detail" class="marginButtons">
<div class="noSpaceWaste">
<div>
<mat-card-subtitle>{{detail.element.tabu1}}</mat-card-subtitle>
</div>
<div>
<mat-card-subtitle>{{detail.element.tabu2}}</mat-card-subtitle>
</div>
<div>
<mat-card-subtitle>{{detail.element.tabu3}}</mat-card-subtitle>
</div>
<div>
<mat-card-subtitle>{{detail.element.tabu4}}</mat-card-subtitle>
</div>
<div>
<mat-card-subtitle>{{detail.element.tabu5}}</mat-card-subtitle>
</div>
<div class="marginButtons">
<!-- Richtig -->
<button
mat-stroked-button *ngIf="detail.element.answer !== answer.richtig"
color="primary" class="marginButtonRight"
(click)="updateAnswer(detail.element, answer.richtig)"
>
Richtig &#10004;
</button>
<button
mat-raised-button
*ngIf="detail.element.answer === answer.richtig"
color="primary" class="marginButtonRight"
>
Richtig &#10004;
</button>
<!-- Zeit abgelaufen -->
<button
mat-stroked-button
*ngIf="detail.element.answer !== answer.zeitAbgelaufen
&& detail.element.s2cID === lastS2CID"
class="marginButtonLeft marginButtonRight"
(click)="updateAnswer(detail.element, answer.zeitAbgelaufen)"
>
Zeit abgelaufen &#9201;
</button>
<button
mat-raised-button
*ngIf="detail.element.answer === answer.zeitAbgelaufen
&& detail.element.s2cID === lastS2CID"
class="marginButtonLeft marginButtonRight"
>
Zeit abgelaufen &#9201;
</button>
<!-- Uebersprungen -->
<button
mat-stroked-button
*ngIf="detail.element.answer !== answer.uebersprungen
&& detail.element.s2cID !== lastS2CID"
color="accent" class="marginButtonLeft marginButtonRight"
(click)="updateAnswer(detail.element, answer.uebersprungen)"
>
Überspringen &#187;
</button>
<button
mat-raised-button
*ngIf="detail.element.answer === answer.uebersprungen
&& detail.element.s2cID !== lastS2CID"
color="accent" class="marginButtonLeft marginButtonRight"
>
Überspringen &#187;
</button>
<!-- Tabooh -->
<button
mat-stroked-button
*ngIf="detail.element.answer !== answer.tabooh"
color="warn" class="marginButtonLeft"
(click)="updateAnswer(detail.element, answer.tabooh)"
>
Tabooh &#10008;
</button>
<button
mat-raised-button
*ngIf="detail.element.answer === answer.tabooh"
color="warn" class="marginButtonLeft"
>
Tabooh &#10008;
</button>
</div>
</div>
</mat-cell>
</ng-container>
<ng-container *ngIf="view !== 'mobileView'" matColumnDef="expandedDetail" class="volleBreite">
<mat-cell *matCellDef="let detail" class="marginButtons">
<!-- Richtig --> <!-- Richtig -->
<button <button
mat-stroked-button *ngIf="detail.element.answer !== answer.richtig" mat-stroked-button *ngIf="detail.element.answer !== answer.richtig"
color="primary" class="expandStyle" color="primary" class="marginButtonRight"
(click)="updateAnswer(detail.element, answer.richtig)" (click)="updateAnswer(detail.element, answer.richtig)"
> >
Richtig &#10004; Richtig &#10004;
...@@ -60,7 +153,7 @@ ...@@ -60,7 +153,7 @@
<button <button
mat-raised-button mat-raised-button
*ngIf="detail.element.answer === answer.richtig" *ngIf="detail.element.answer === answer.richtig"
color="primary" class="expandStyle" color="primary" class="marginButtonRight"
> >
Richtig &#10004; Richtig &#10004;
</button> </button>
...@@ -69,7 +162,7 @@ ...@@ -69,7 +162,7 @@
mat-stroked-button mat-stroked-button
*ngIf="detail.element.answer !== answer.zeitAbgelaufen *ngIf="detail.element.answer !== answer.zeitAbgelaufen
&& detail.element.s2cID === lastS2CID" && detail.element.s2cID === lastS2CID"
class="expandStyle" class="marginButtonLeft marginButtonRight"
(click)="updateAnswer(detail.element, answer.zeitAbgelaufen)" (click)="updateAnswer(detail.element, answer.zeitAbgelaufen)"
> >
Zeit abgelaufen &#9201; Zeit abgelaufen &#9201;
...@@ -78,7 +171,7 @@ ...@@ -78,7 +171,7 @@
mat-raised-button mat-raised-button
*ngIf="detail.element.answer === answer.zeitAbgelaufen *ngIf="detail.element.answer === answer.zeitAbgelaufen
&& detail.element.s2cID === lastS2CID" && detail.element.s2cID === lastS2CID"
class="expandStyle" class="marginButtonLeft marginButtonRight"
> >
Zeit abgelaufen &#9201; Zeit abgelaufen &#9201;
</button> </button>
...@@ -87,7 +180,7 @@ ...@@ -87,7 +180,7 @@
mat-stroked-button mat-stroked-button
*ngIf="detail.element.answer !== answer.uebersprungen *ngIf="detail.element.answer !== answer.uebersprungen
&& detail.element.s2cID !== lastS2CID" && detail.element.s2cID !== lastS2CID"
color="accent" class="expandStyle" color="accent" class="marginButtonLeft marginButtonRight"
(click)="updateAnswer(detail.element, answer.uebersprungen)" (click)="updateAnswer(detail.element, answer.uebersprungen)"
> >
Überspringen &#187; Überspringen &#187;
...@@ -96,7 +189,7 @@ ...@@ -96,7 +189,7 @@
mat-raised-button mat-raised-button
*ngIf="detail.element.answer === answer.uebersprungen *ngIf="detail.element.answer === answer.uebersprungen
&& detail.element.s2cID !== lastS2CID" && detail.element.s2cID !== lastS2CID"
color="accent" class="expandStyle" color="accent" class="marginButtonLeft marginButtonRight"
> >
Überspringen &#187; Überspringen &#187;
</button> </button>
...@@ -104,7 +197,7 @@ ...@@ -104,7 +197,7 @@
<button <button
mat-stroked-button mat-stroked-button
*ngIf="detail.element.answer !== answer.tabooh" *ngIf="detail.element.answer !== answer.tabooh"
color="warn" class="expandStyle" color="warn" class="marginButtonLeft"
(click)="updateAnswer(detail.element, answer.tabooh)" (click)="updateAnswer(detail.element, answer.tabooh)"
> >
Tabooh &#10008; Tabooh &#10008;
...@@ -112,7 +205,7 @@ ...@@ -112,7 +205,7 @@
<button <button
mat-raised-button mat-raised-button
*ngIf="detail.element.answer === answer.tabooh" *ngIf="detail.element.answer === answer.tabooh"
color="warn" class="expandStyle" color="warn" class="marginButtonLeft"
> >
Tabooh &#10008; Tabooh &#10008;
</button> </button>
......
...@@ -46,3 +46,20 @@ ...@@ -46,3 +46,20 @@
.element-row-noEdit { .element-row-noEdit {
position: relative; position: relative;
} }
.marginButtonRight {
margin-right: clamp(7px, 2%, 25px);
}
.marginButtonLeft {
margin-left: clamp(7px, 4%, 25px);
}
.marginButtons {
display: flex;
justify-content: center;
}
.noSpaceWaste {
width: 100%;
}
...@@ -3,6 +3,7 @@ import {animate, state, style, transition, trigger} from '@angular/animations'; ...@@ -3,6 +3,7 @@ import {animate, state, style, transition, trigger} from '@angular/animations';
import {DataSource} from '@angular/cdk/table'; import {DataSource} from '@angular/cdk/table';
import {Observable, of} from 'rxjs'; import {Observable, of} from 'rxjs';
import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService';
import {ViewModus} from '../dao/viewModus';
export interface CardResultHistory { export interface CardResultHistory {
answer: Answer; answer: Answer;
...@@ -50,6 +51,7 @@ export class RoundHistoryComponent extends DataSource<any> implements OnInit, On ...@@ -50,6 +51,7 @@ export class RoundHistoryComponent extends DataSource<any> implements OnInit, On
gameStatus = new EventEmitter(); gameStatus = new EventEmitter();
@Output() @Output()
canUpdate = new EventEmitter(); canUpdate = new EventEmitter();
view = 'desktopView';
redTurn = ''; redTurn = '';
lastS2CID = 0; lastS2CID = 0;
...@@ -65,11 +67,21 @@ export class RoundHistoryComponent extends DataSource<any> implements OnInit, On ...@@ -65,11 +67,21 @@ export class RoundHistoryComponent extends DataSource<any> implements OnInit, On
expandedElement: any; expandedElement: any;
isExpansionDetailRow = (i: number, row: object) => row.hasOwnProperty('detailRow'); isExpansionDetailRow = (i: number, row: object) => row.hasOwnProperty('detailRow');
constructor(private service: TabuMiddlewareService) { constructor(
private service: TabuMiddlewareService,
private screen: ViewModus) {
super(); super();
screen.$view.subscribe(
view => {
this.view = view;
this.setDisplayColumns();
});
} }
ngOnInit(): void { ngOnInit(): void {
this.view = this.screen.actuallView;
this.setDisplayColumns();
console.log("ACTUAL VIEW: ",this.view);
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
...@@ -93,6 +105,14 @@ export class RoundHistoryComponent extends DataSource<any> implements OnInit, On ...@@ -93,6 +105,14 @@ export class RoundHistoryComponent extends DataSource<any> implements OnInit, On
} }
} }
setDisplayColumns(): void {
if (this.view === 'mobileView') {
this.displayedColumns = ['answer', 'solution'];
} else {
this.displayedColumns = ['answer', 'solution', 'tabu1', 'tabu2', 'tabu3', 'tabu4', 'tabu5'];
}
}
getRoundDataFromHistory(): void { getRoundDataFromHistory(): void {
this.roundHistory = []; this.roundHistory = [];
let redTurn = null; let redTurn = null;
......
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