Skip to content

Commit

Permalink
refactor: remove unused styling, logic and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrefj committed Jul 24, 2024
1 parent 9b64d4e commit 6f8b736
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="feedback-container">
<app-i-avatar class="i-avatar" [height]="170" [width]="35" [color]="CustomColorsIO.white"></app-i-avatar>
<app-speech-bubble
class="speech-bubble right"
class="speech-bubble"
[pointerSide]="PointerSide.Left"
[arrowAlignment]="ArrowAlignment.Center"
[isFlipped]="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { DrawingService } from '../../services/drawing.service';
styleUrl: './game-drawing-feedback.component.scss',
})
export class GameDrawingFeedbackComponent implements OnInit {
@Input() hasCorrectGuess: boolean | undefined; // TODO check if it is possible to disregard undefined type for later
hasCorrectGuess = false;
feedbackTitleKey = '';
feedbackDescriptionKey = '';
correctGuess = true;
Expand All @@ -27,6 +27,7 @@ export class GameDrawingFeedbackComponent implements OnInit {
constructor(private drawingService: DrawingService) {}

ngOnInit(): void {
this.hasCorrectGuess = this.drawingService.lastResult.hasWon;
this.setFeedbackText();
this.label = this.drawingService.label;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export class CorrectGuessComponent implements OnInit {
this.label = this.drawingService.label;
if (this.gameStateService.isSingleplayer()) {
this.exampleDrawings = this.exampleDrawingService.getExampleDrawings(3);
return;
} else {
this.exampleDrawings = this.multiplayerService.getExampleDrawings(3);
}
this.exampleDrawings = this.multiplayerService.getExampleDrawings(3);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@
.o-avatar {
margin-top: 2em;
}

.hideImg {
display: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,11 @@ footer {
text-decoration: none;
color: #fff;
}
.button-container:before {
position: absolute;
content: '';
display: inline-block;
top: -180px;
left: 0;
width: 30px;
height: 100%;
animation: shiny-btn1 3s ease-in-out infinite;
}

.button-container:hover {
opacity: 0.9;
}

.button-container:active {
box-shadow: 4px 4px 6px 0 rgba(255, 255, 255, 0.15), -4px -4px 6px 0 rgba(116, 125, 136, 0.2),
inset -4px -4px 6px 0 rgba(255, 255, 255, 0.2), inset 4px 4px 6px 0 rgba(0, 0, 0, 0.2);
Expand All @@ -59,5 +51,5 @@ footer {
}

.button-icon {
height: 40px;
height: 36px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class GameIntermediateResultFooterComponent implements OnInit {

if (this.gameStateService.isSingleplayer()) return;

this.isWaitingForPlayer = true;
this.isWaitingForPlayer = true; // default in multiplayer set to true
this.multiplayerService.stateInfo$.subscribe((res) => {
if (res.ready) {
this.isWaitingForPlayer = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
><mat-icon id="confirmExitIdleButtonIcon">home</mat-icon>{{ 'END_NOW_BUTTON' | translate }}</span
>
</button>
<button class="confirmExitIdleButton" id="stayButton" (click)="closeDialog()">
<button class="confirmExitIdleButton" (click)="closeDialog()">
{{ 'STAY_BUTTON' | translate }}
</button>
</mat-dialog-actions>
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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<ConfirmExitDialogComponent>);
Expand All @@ -36,6 +38,7 @@ export class ConfirmExitDialogComponent {
goToWelcomePage() {
this.dialogRef.close();
this.gameStateService.clearState();
this.drawingService.clearState();

if (this.gameStateService.isMultiplayer()) {
this.multiplayerService.clearState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<div class="container-background">
<div id="intermediate-container">
<app-game-intermediate-result-header class="result-header"></app-game-intermediate-result-header>
<app-game-drawing-feedback class="avatar-feedback" [hasCorrectGuess]="result?.hasWon"></app-game-drawing-feedback>
<app-game-drawing-display
class="user-drawing-and-score"
[drawingURL]="result?.imageData"
[hasCorrectGuess]="result?.hasWon"
[roundScore]="result?.score"
></app-game-drawing-display>
<app-game-drawing-feedback class="avatar-feedback"></app-game-drawing-feedback>
<app-game-drawing-display class="user-drawing-and-score"></app-game-drawing-display>
<app-game-example-drawings class="example-drawings"></app-game-example-drawings>
<app-game-intermediate-result-footer class="footer"></app-game-intermediate-result-footer>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit 6f8b736

Please sign in to comment.