From 6d353cc20246954ba0d7dd2cbaf8517d56d93d71 Mon Sep 17 00:00:00 2001 From: Jan-Marlon Leibl Date: Thu, 15 May 2025 14:04:43 +0200 Subject: [PATCH] style: fix formatting and add missing commas in code --- frontend/src/app/app.component.ts | 4 ++-- .../shared/directives/play-sound.directive.ts | 4 ++-- .../src/app/shared/services/audio.service.ts | 8 ++++---- .../services/sound-initializer.service.ts | 17 ++++++++++------- frontend/src/styles.css | 9 ++++++--- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index 90ab687..4e55f7e 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -21,11 +21,11 @@ import { SoundInitializerService } from './shared/services/sound-initializer.ser PlaySoundDirective, ], templateUrl: './app.component.html', - hostDirectives: [PlaySoundDirective] + hostDirectives: [PlaySoundDirective], }) export class AppComponent { private soundInitializer = inject(SoundInitializerService); - + showLogin = signal(false); showRegister = signal(false); showRecoverPassword = signal(false); diff --git a/frontend/src/app/shared/directives/play-sound.directive.ts b/frontend/src/app/shared/directives/play-sound.directive.ts index 1b2d3e1..f949f64 100644 --- a/frontend/src/app/shared/directives/play-sound.directive.ts +++ b/frontend/src/app/shared/directives/play-sound.directive.ts @@ -3,7 +3,7 @@ import { AudioService } from '../services/audio.service'; @Directive({ selector: '[appPlaySound]', - standalone: true + standalone: true, }) export class PlaySoundDirective { private audioService = inject(AudioService); @@ -12,4 +12,4 @@ export class PlaySoundDirective { onClick() { this.audioService.playBetSound(); } -} \ No newline at end of file +} diff --git a/frontend/src/app/shared/services/audio.service.ts b/frontend/src/app/shared/services/audio.service.ts index 8e9b4d9..5e716fb 100644 --- a/frontend/src/app/shared/services/audio.service.ts +++ b/frontend/src/app/shared/services/audio.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AudioService { private audioCache = new Map(); @@ -18,12 +18,12 @@ export class AudioService { playBetSound(): void { const audio = this.getAudio('bet.mp3'); audio.currentTime = 0; - audio.play().catch(error => console.error('Error playing bet sound:', error)); + audio.play().catch((error) => console.error('Error playing bet sound:', error)); } playWinSound(): void { const audio = this.getAudio('win.mp3'); audio.currentTime = 0; - audio.play().catch(error => console.error('Error playing win sound:', error)); + audio.play().catch((error) => console.error('Error playing win sound:', error)); } -} \ No newline at end of file +} diff --git a/frontend/src/app/shared/services/sound-initializer.service.ts b/frontend/src/app/shared/services/sound-initializer.service.ts index f60f27d..47d09e0 100644 --- a/frontend/src/app/shared/services/sound-initializer.service.ts +++ b/frontend/src/app/shared/services/sound-initializer.service.ts @@ -1,7 +1,7 @@ import { Injectable, Renderer2, RendererFactory2 } from '@angular/core'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class SoundInitializerService { private renderer: Renderer2; @@ -9,7 +9,7 @@ export class SoundInitializerService { constructor(rendererFactory: RendererFactory2) { this.renderer = rendererFactory.createRenderer(null, null); - + this.observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { mutation.addedNodes.forEach((node) => { @@ -22,7 +22,7 @@ export class SoundInitializerService { } initialize() { - document.querySelectorAll('button, a').forEach(element => { + document.querySelectorAll('button, a').forEach((element) => { if (!element.hasAttribute('appPlaySound')) { this.renderer.setAttribute(element, 'appPlaySound', ''); } @@ -30,19 +30,22 @@ export class SoundInitializerService { this.observer.observe(document.body, { childList: true, - subtree: true + subtree: true, }); } private processElement(element: HTMLElement) { - if ((element.tagName === 'BUTTON' || element.tagName === 'A') && !element.hasAttribute('appPlaySound')) { + if ( + (element.tagName === 'BUTTON' || element.tagName === 'A') && + !element.hasAttribute('appPlaySound') + ) { this.renderer.setAttribute(element, 'appPlaySound', ''); } - element.querySelectorAll('button, a').forEach(child => { + element.querySelectorAll('button, a').forEach((child) => { if (!child.hasAttribute('appPlaySound')) { this.renderer.setAttribute(child, 'appPlaySound', ''); } }); } -} \ No newline at end of file +} diff --git a/frontend/src/styles.css b/frontend/src/styles.css index beb0723..57a0f6a 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -175,14 +175,17 @@ a { @apply bg-deep-blue-light/50 hover:bg-deep-blue-light w-full py-2.5 my-2 border border-deep-blue-light/30 hover:border-deep-blue-light/50; } -button, a { +button, +a { -webkit-tap-highlight-color: transparent; } -button[appPlaySound], a[appPlaySound] { +button[appPlaySound], +a[appPlaySound] { cursor: pointer; } -button:not([appPlaySound]), a:not([appPlaySound]) { +button:not([appPlaySound]), +a:not([appPlaySound]) { --add-sound-directive: true; }