From 6f8b7368b1cd990eda7d27806a3e2576abe5676f Mon Sep 17 00:00:00 2001 From: sondrefj Date: Wed, 24 Jul 2024 13:43:59 +0200 Subject: [PATCH] refactor: remove unused styling, logic and variables --- .../game-drawing-display.component.scss | 2 +- .../game-drawing-display.component.ts | 9 ++++++--- .../game-drawing-feedback.component.html | 2 +- .../game-drawing-feedback.component.ts | 3 ++- .../correct-guess/correct-guess.component.ts | 4 ++-- .../wrong-guess/wrong-guess.component.scss | 4 ---- .../game-intermediate-result-footer.component.scss | 14 +++----------- .../game-intermediate-result-footer.component.ts | 2 +- .../confirm-exit-dialog.component.html | 2 +- .../confirm-exit-dialog.component.ts | 5 ++++- .../game-progress-bar.component.ts | 1 - .../game-intermediate-result.component.html | 9 ++------- .../game-intermediate-result.component.ts | 5 ----- 13 files changed, 23 insertions(+), 39 deletions(-) diff --git a/src/app/game/game-intermediate-result/game-drawing-display/game-drawing-display.component.scss b/src/app/game/game-intermediate-result/game-drawing-display/game-drawing-display.component.scss index 09625927..187ff83d 100644 --- a/src/app/game/game-intermediate-result/game-drawing-display/game-drawing-display.component.scss +++ b/src/app/game/game-intermediate-result/game-drawing-display/game-drawing-display.component.scss @@ -9,7 +9,7 @@ .user-drawing-board { border-radius: 0.6em; - padding: 0.4em; // this is what controls the width of the border + padding: 0.4em; // controls the width of the border background-color: white; width: 390px; height: 280px; diff --git a/src/app/game/game-intermediate-result/game-drawing-display/game-drawing-display.component.ts b/src/app/game/game-intermediate-result/game-drawing-display/game-drawing-display.component.ts index 2aaa443e..9e155623 100644 --- a/src/app/game/game-intermediate-result/game-drawing-display/game-drawing-display.component.ts +++ b/src/app/game/game-intermediate-result/game-drawing-display/game-drawing-display.component.ts @@ -10,15 +10,18 @@ import { DrawingService } from '../../services/drawing.service'; styleUrl: './game-drawing-display.component.scss', }) export class GameDrawingDisplayComponent implements OnInit { - @Input() hasCorrectGuess: boolean | undefined; - @Input() drawingURL: string | undefined; - @Input() roundScore: number | undefined; secondsUsed = 0; + drawingURL = ''; + hasCorrectGuess = false; + roundScore = 0; constructor(private drawingService: DrawingService) {} ngOnInit(): void { this.secondsUsed = this.drawingService.getSecondsUsed(); + this.drawingURL = this.drawingService.lastResult.imageData; + this.hasCorrectGuess = this.drawingService.lastResult.hasWon; + this.roundScore = this.drawingService.lastResult.score; this.drawingService.resetSecondsUsed(); } diff --git a/src/app/game/game-intermediate-result/game-drawing-feedback/game-drawing-feedback.component.html b/src/app/game/game-intermediate-result/game-drawing-feedback/game-drawing-feedback.component.html index 766e8121..668adc9c 100644 --- a/src/app/game/game-intermediate-result/game-drawing-feedback/game-drawing-feedback.component.html +++ b/src/app/game/game-intermediate-result/game-drawing-feedback/game-drawing-feedback.component.html @@ -1,7 +1,7 @@
{ if (res.ready) { this.isWaitingForPlayer = false; diff --git a/src/app/game/game-intermediate-result/game-intermediate-result-header/confirm-exit-dialog/confirm-exit-dialog.component.html b/src/app/game/game-intermediate-result/game-intermediate-result-header/confirm-exit-dialog/confirm-exit-dialog.component.html index 07debff7..c21cdc6f 100644 --- a/src/app/game/game-intermediate-result/game-intermediate-result-header/confirm-exit-dialog/confirm-exit-dialog.component.html +++ b/src/app/game/game-intermediate-result/game-intermediate-result-header/confirm-exit-dialog/confirm-exit-dialog.component.html @@ -9,7 +9,7 @@ >home{{ 'END_NOW_BUTTON' | translate }} - diff --git a/src/app/game/game-intermediate-result/game-intermediate-result-header/confirm-exit-dialog/confirm-exit-dialog.component.ts b/src/app/game/game-intermediate-result/game-intermediate-result-header/confirm-exit-dialog/confirm-exit-dialog.component.ts index 51f0ad55..9ca57d59 100644 --- a/src/app/game/game-intermediate-result/game-intermediate-result-header/confirm-exit-dialog/confirm-exit-dialog.component.ts +++ b/src/app/game/game-intermediate-result/game-intermediate-result-header/confirm-exit-dialog/confirm-exit-dialog.component.ts @@ -7,6 +7,7 @@ import { Component, inject, ViewEncapsulation } from '@angular/core'; import { MatButton } from '@angular/material/button'; import { MatDialogActions, MatDialogContent, MatDialogRef } from '@angular/material/dialog'; import { MatIcon } from '@angular/material/icon'; +import { DrawingService } from '@/app/game/services/drawing.service'; @Component({ selector: 'app-confirm-exit-dialog', @@ -20,7 +21,8 @@ export class ConfirmExitDialogComponent { constructor( private router: Router, private gameStateService: GameStateService, - private multiplayerService: MultiplayerService + private multiplayerService: MultiplayerService, + private drawingService: DrawingService ) {} readonly dialogRef = inject(MatDialogRef); @@ -36,6 +38,7 @@ export class ConfirmExitDialogComponent { goToWelcomePage() { this.dialogRef.close(); this.gameStateService.clearState(); + this.drawingService.clearState(); if (this.gameStateService.isMultiplayer()) { this.multiplayerService.clearState(); diff --git a/src/app/game/game-intermediate-result/game-intermediate-result-header/game-progress-bar/game-progress-bar.component.ts b/src/app/game/game-intermediate-result/game-intermediate-result-header/game-progress-bar/game-progress-bar.component.ts index 035213fb..24408fd7 100644 --- a/src/app/game/game-intermediate-result/game-intermediate-result-header/game-progress-bar/game-progress-bar.component.ts +++ b/src/app/game/game-intermediate-result/game-intermediate-result-header/game-progress-bar/game-progress-bar.component.ts @@ -11,7 +11,6 @@ import { GameStateService } from '@/app/game/services/game-state-service'; styleUrl: './game-progress-bar.component.scss', }) export class GameProgressBarComponent implements OnInit { - roundNumberProgress = ''; currentRoundNumber = 0; totalRounds = 0; diff --git a/src/app/game/game-intermediate-result/game-intermediate-result.component.html b/src/app/game/game-intermediate-result/game-intermediate-result.component.html index 95b81c98..d675a620 100644 --- a/src/app/game/game-intermediate-result/game-intermediate-result.component.html +++ b/src/app/game/game-intermediate-result/game-intermediate-result.component.html @@ -1,13 +1,8 @@
- - + +
diff --git a/src/app/game/game-intermediate-result/game-intermediate-result.component.ts b/src/app/game/game-intermediate-result/game-intermediate-result.component.ts index d3fe25bb..5d3e965e 100644 --- a/src/app/game/game-intermediate-result/game-intermediate-result.component.ts +++ b/src/app/game/game-intermediate-result/game-intermediate-result.component.ts @@ -26,9 +26,6 @@ import { GameStateService } from '../services/game-state-service'; ], }) export class GameIntermediateResultComponent implements OnInit, OnDestroy { - result: Result | undefined; - isSingleplayer = false; - constructor( private gameStateService: GameStateService, private drawingService: DrawingService, @@ -38,8 +35,6 @@ export class GameIntermediateResultComponent implements OnInit, OnDestroy { ngOnInit(): void { this.gameStateService.savePageToLocalStorage(GAMESTATE.intermediateResult); - this.isSingleplayer = this.gameStateService.isSingleplayer(); - this.result = this.drawingService.lastResult; this.translationService.loadTranslations(this.translationService.getCurrentLang()).subscribe(); if (this.gameStateService.isSingleplayer()) return;