diff --git a/frontend/src/app/feature/landing/landing.component.ts b/frontend/src/app/feature/landing/landing.component.ts
index a3b77e3..b12c5d7 100644
--- a/frontend/src/app/feature/landing/landing.component.ts
+++ b/frontend/src/app/feature/landing/landing.component.ts
@@ -1,13 +1,12 @@
-import { ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit } from '@angular/core';
-import { NgFor } from '@angular/common';
-import { NavbarComponent } from '@shared/components/navbar/navbar.component';
-import { RouterLink } from '@angular/router';
-import { AuthService } from '@service/auth.service';
+import {ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit} from '@angular/core';
+import {NgFor} from '@angular/common';
+import {RouterLink} from '@angular/router';
+import {AuthService} from '@service/auth.service';
@Component({
selector: 'app-landing-page',
standalone: true,
- imports: [NavbarComponent, NgFor, RouterLink],
+ imports: [NgFor, RouterLink],
templateUrl: './landing.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
diff --git a/frontend/src/app/feature/login-success/login-success.component.css b/frontend/src/app/feature/login-success/login-success.component.css
deleted file mode 100644
index e69de29..0000000
diff --git a/frontend/src/app/feature/login-success/login-success.component.html b/frontend/src/app/feature/login-success/login-success.component.html
deleted file mode 100644
index ba9d449..0000000
--- a/frontend/src/app/feature/login-success/login-success.component.html
+++ /dev/null
@@ -1 +0,0 @@
-
Logging in...
diff --git a/frontend/src/app/feature/login-success/login-success.component.ts b/frontend/src/app/feature/login-success/login-success.component.ts
deleted file mode 100644
index d10a322..0000000
--- a/frontend/src/app/feature/login-success/login-success.component.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core';
-import { Router } from '@angular/router';
-import { AuthService } from '../../service/auth.service';
-import { OAuthService } from 'angular-oauth2-oidc';
-
-@Component({
- selector: 'app-login-success',
- standalone: true,
- imports: [],
- templateUrl: './login-success.component.html',
- styleUrl: './login-success.component.css',
- changeDetection: ChangeDetectionStrategy.OnPush,
-})
-export default class LoginSuccessComponent implements OnInit {
- private authService: AuthService = inject(AuthService);
- private oauthService: OAuthService = inject(OAuthService);
- private router: Router = inject(Router);
-
- async ngOnInit() {
- try {
- if (this.oauthService.hasValidAccessToken()) {
- this.router.navigate(['/home']);
- } else {
- setTimeout(() => {
- if (this.oauthService.hasValidAccessToken() || this.authService.getUser()) {
- this.router.navigate(['/home']);
- } else {
- this.router.navigate(['/']);
- }
- }, 3000);
- }
- } catch (err) {
- console.error('Error during login callback:', err);
- setTimeout(() => {
- if (this.authService.isLoggedIn()) {
- this.router.navigate(['/home']);
- } else {
- this.router.navigate(['/']);
- }
- }, 3000);
- }
- }
-}
diff --git a/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.html b/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.html
index cc234ac..d4abab7 100644
--- a/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.html
+++ b/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.html
@@ -1,5 +1,3 @@
-
-
Lootbox Öffnen
diff --git a/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.ts b/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.ts
index 97e5200..2624299 100644
--- a/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.ts
+++ b/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.ts
@@ -1,17 +1,16 @@
-import { ChangeDetectorRef, Component } from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { ActivatedRoute, Router } from '@angular/router';
-import { LootboxService } from '../services/lootbox.service';
-import { LootBox, Reward } from 'app/model/LootBox';
-import { NavbarComponent } from '@shared/components/navbar/navbar.component';
-import { UserService } from '@service/user.service';
-import { User } from 'app/model/User';
-import { AuthService } from '@service/auth.service';
+import {ChangeDetectorRef, Component} from '@angular/core';
+import {CommonModule} from '@angular/common';
+import {ActivatedRoute, Router} from '@angular/router';
+import {LootboxService} from '../services/lootbox.service';
+import {LootBox, Reward} from 'app/model/LootBox';
+import {UserService} from '@service/user.service';
+import {User} from 'app/model/User';
+import {AuthService} from '@service/auth.service';
@Component({
selector: 'app-lootbox-opening',
standalone: true,
- imports: [CommonModule, NavbarComponent],
+ imports: [CommonModule],
templateUrl: './lootbox-opening.component.html',
styleUrls: ['./lootbox-opening.component.css'],
})
diff --git a/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.html b/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.html
index 25d8df0..76fcc04 100644
--- a/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.html
+++ b/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.html
@@ -1,4 +1,3 @@
-
Lootboxen
diff --git a/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.ts b/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.ts
index dc39869..cc3e91f 100644
--- a/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.ts
+++ b/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.ts
@@ -1,18 +1,17 @@
-import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { NavbarComponent } from '@shared/components/navbar/navbar.component';
-import { LootboxService } from '../services/lootbox.service';
-import { LootBox } from 'app/model/LootBox';
-import { Router } from '@angular/router';
-import { timeout } from 'rxjs';
-import { User } from 'app/model/User';
-import { AuthService } from '@service/auth.service';
-import { UserService } from '@service/user.service';
+import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
+import {CommonModule} from '@angular/common';
+import {LootboxService} from '../services/lootbox.service';
+import {LootBox} from 'app/model/LootBox';
+import {Router} from '@angular/router';
+import {timeout} from 'rxjs';
+import {User} from 'app/model/User';
+import {AuthService} from '@service/auth.service';
+import {UserService} from '@service/user.service';
@Component({
selector: 'app-lootbox-selection',
standalone: true,
- imports: [CommonModule, NavbarComponent],
+ imports: [CommonModule],
templateUrl: './lootbox-selection.component.html',
styleUrls: ['./lootbox-selection.component.css'],
})
diff --git a/frontend/src/app/feature/transaction-history/transaction-history.component.ts b/frontend/src/app/feature/transaction-history/transaction-history.component.ts
index 338ef4e..b0e12f8 100644
--- a/frontend/src/app/feature/transaction-history/transaction-history.component.ts
+++ b/frontend/src/app/feature/transaction-history/transaction-history.component.ts
@@ -1,15 +1,8 @@
-import {
- ChangeDetectionStrategy,
- Component,
- EventEmitter,
- inject,
- Input,
- Output,
-} from '@angular/core';
-import { TransactionService } from '@service/transaction.service';
-import { Observable } from 'rxjs';
-import { AsyncPipe, CurrencyPipe, DatePipe, NgIf } from '@angular/common';
-import { TransactionData } from '../../model/TransactionData';
+import {ChangeDetectionStrategy, Component, EventEmitter, inject, Input, Output,} from '@angular/core';
+import {TransactionService} from '@service/transaction.service';
+import {Observable} from 'rxjs';
+import {AsyncPipe, CurrencyPipe, DatePipe, NgIf} from '@angular/common';
+import {TransactionData} from '../../model/TransactionData';
const PER_PAGE = 5;
diff --git a/frontend/src/app/shared/components/navbar/navbar.component.html b/frontend/src/app/shared/components/navbar/navbar.component.html
index 90b63eb..749437f 100644
--- a/frontend/src/app/shared/components/navbar/navbar.component.html
+++ b/frontend/src/app/shared/components/navbar/navbar.component.html
@@ -11,7 +11,7 @@
- @if (!isLoggedIn) {
+ @if (!isLoggedIn()) {
Anmelden
Registrieren
}
- @if (isLoggedIn) {
+ @if (isLoggedIn()) {
Spiele
- @if (!isLoggedIn) {
+ @if (!isLoggedIn()) {
Anmelden
@@ -80,7 +80,7 @@
>Registrieren
}
- @if (isLoggedIn) {
+ @if (isLoggedIn()) {
}
diff --git a/frontend/src/app/shared/components/navbar/navbar.component.ts b/frontend/src/app/shared/components/navbar/navbar.component.ts
index 5d44f60..8f646f5 100644
--- a/frontend/src/app/shared/components/navbar/navbar.component.ts
+++ b/frontend/src/app/shared/components/navbar/navbar.component.ts
@@ -21,7 +21,7 @@ import { AnimatedNumberComponent } from '@blackjack/components/animated-number/a
export class NavbarComponent implements OnInit, OnDestroy {
isMenuOpen = false;
private authService: AuthService = inject(AuthService);
- isLoggedIn = this.authService.isLoggedIn();
+ isLoggedIn = signal(this.authService.isLoggedIn());
private authSubscription!: Subscription;
public balance = signal(0);
@@ -30,6 +30,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
this.authSubscription = this.authService.userSubject.subscribe({
next: (user) => {
this.balance.set(user?.balance ?? 0);
+ this.isLoggedIn.set(this.authService.isLoggedIn());
},
});
}
From f42070cfaeff1010f6518d389c8328ecb7164d17 Mon Sep 17 00:00:00 2001
From: Phan Huy Tran
Date: Wed, 14 May 2025 09:34:27 +0200
Subject: [PATCH 019/225] style: run quality tools
---
frontend/src/app/app.component.ts | 2 +-
.../app/feature/auth/login/login.component.ts | 12 +++----
.../auth/register/register.component.ts | 12 +++----
.../app/feature/deposit/deposit.component.ts | 14 ++++----
.../game/blackjack/blackjack.component.ts | 32 +++++++++----------
.../app/feature/game/slots/slots.component.ts | 23 ++++++++-----
.../src/app/feature/home/home.component.ts | 20 ++++++------
.../app/feature/landing/landing.component.ts | 8 ++---
.../lootbox-opening.component.ts | 16 +++++-----
.../lootbox-selection.component.ts | 18 +++++------
.../transaction-history.component.ts | 17 +++++++---
11 files changed, 94 insertions(+), 80 deletions(-)
diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts
index 07aa848..3e25d5b 100644
--- a/frontend/src/app/app.component.ts
+++ b/frontend/src/app/app.component.ts
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterOutlet } from '@angular/router';
import { FooterComponent } from '@shared/components/footer/footer.component';
-import {NavbarComponent} from "@shared/components/navbar/navbar.component";
+import { NavbarComponent } from '@shared/components/navbar/navbar.component';
@Component({
selector: 'app-root',
diff --git a/frontend/src/app/feature/auth/login/login.component.ts b/frontend/src/app/feature/auth/login/login.component.ts
index 3067ba6..1ed3537 100644
--- a/frontend/src/app/feature/auth/login/login.component.ts
+++ b/frontend/src/app/feature/auth/login/login.component.ts
@@ -1,9 +1,9 @@
-import {Component} from '@angular/core';
-import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
-import {Router, RouterLink} from '@angular/router';
-import {LoginRequest} from '../../../model/auth/LoginRequest';
-import {AuthService} from '../../../service/auth.service';
-import {CommonModule} from '@angular/common';
+import { Component } from '@angular/core';
+import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
+import { Router, RouterLink } from '@angular/router';
+import { LoginRequest } from '../../../model/auth/LoginRequest';
+import { AuthService } from '../../../service/auth.service';
+import { CommonModule } from '@angular/common';
@Component({
selector: 'app-login',
diff --git a/frontend/src/app/feature/auth/register/register.component.ts b/frontend/src/app/feature/auth/register/register.component.ts
index e14cd8f..22a032f 100644
--- a/frontend/src/app/feature/auth/register/register.component.ts
+++ b/frontend/src/app/feature/auth/register/register.component.ts
@@ -1,9 +1,9 @@
-import {Component} from '@angular/core';
-import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
-import {Router, RouterLink} from '@angular/router';
-import {RegisterRequest} from '../../../model/auth/RegisterRequest';
-import {AuthService} from '@service/auth.service';
-import {CommonModule} from '@angular/common';
+import { Component } from '@angular/core';
+import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
+import { Router, RouterLink } from '@angular/router';
+import { RegisterRequest } from '../../../model/auth/RegisterRequest';
+import { AuthService } from '@service/auth.service';
+import { CommonModule } from '@angular/common';
@Component({
selector: 'app-register',
diff --git a/frontend/src/app/feature/deposit/deposit.component.ts b/frontend/src/app/feature/deposit/deposit.component.ts
index 20c6aa5..8768bbe 100644
--- a/frontend/src/app/feature/deposit/deposit.component.ts
+++ b/frontend/src/app/feature/deposit/deposit.component.ts
@@ -14,14 +14,14 @@ import {
SimpleChanges,
ViewChild,
} from '@angular/core';
-import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
-import {loadStripe, Stripe} from '@stripe/stripe-js';
-import {debounceTime} from 'rxjs';
-import {CommonModule} from '@angular/common';
+import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
+import { loadStripe, Stripe } from '@stripe/stripe-js';
+import { debounceTime } from 'rxjs';
+import { CommonModule } from '@angular/common';
import gsap from 'gsap';
-import {DepositService} from '@service/deposit.service';
-import {environment} from '@environments/environment';
-import {ModalAnimationService} from '@shared/services/modal-animation.service';
+import { DepositService } from '@service/deposit.service';
+import { environment } from '@environments/environment';
+import { ModalAnimationService } from '@shared/services/modal-animation.service';
@Component({
selector: 'app-deposit',
diff --git a/frontend/src/app/feature/game/blackjack/blackjack.component.ts b/frontend/src/app/feature/game/blackjack/blackjack.component.ts
index a6eb6a4..63c6a3a 100644
--- a/frontend/src/app/feature/game/blackjack/blackjack.component.ts
+++ b/frontend/src/app/feature/game/blackjack/blackjack.component.ts
@@ -1,19 +1,19 @@
-import {ChangeDetectionStrategy, Component, inject, OnInit, signal} from '@angular/core';
-import {CommonModule} from '@angular/common';
-import {Router} from '@angular/router';
-import {DealerHandComponent} from './components/dealer-hand/dealer-hand.component';
-import {PlayerHandComponent} from './components/player-hand/player-hand.component';
-import {GameControlsComponent} from './components/game-controls/game-controls.component';
-import {GameInfoComponent} from './components/game-info/game-info.component';
-import {BlackjackGame, Card} from '@blackjack/models/blackjack.model';
-import {BlackjackService} from '@blackjack/services/blackjack.service';
-import {HttpErrorResponse} from '@angular/common/http';
-import {GameResultComponent} from '@blackjack/components/game-result/game-result.component';
-import {GameState} from '@blackjack/enum/gameState';
-import {UserService} from '@service/user.service';
-import {timer} from 'rxjs';
-import {DebtDialogComponent} from '@shared/components/debt-dialog/debt-dialog.component';
-import {AuthService} from '@service/auth.service';
+import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { Router } from '@angular/router';
+import { DealerHandComponent } from './components/dealer-hand/dealer-hand.component';
+import { PlayerHandComponent } from './components/player-hand/player-hand.component';
+import { GameControlsComponent } from './components/game-controls/game-controls.component';
+import { GameInfoComponent } from './components/game-info/game-info.component';
+import { BlackjackGame, Card } from '@blackjack/models/blackjack.model';
+import { BlackjackService } from '@blackjack/services/blackjack.service';
+import { HttpErrorResponse } from '@angular/common/http';
+import { GameResultComponent } from '@blackjack/components/game-result/game-result.component';
+import { GameState } from '@blackjack/enum/gameState';
+import { UserService } from '@service/user.service';
+import { timer } from 'rxjs';
+import { DebtDialogComponent } from '@shared/components/debt-dialog/debt-dialog.component';
+import { AuthService } from '@service/auth.service';
@Component({
selector: 'app-blackjack',
diff --git a/frontend/src/app/feature/game/slots/slots.component.ts b/frontend/src/app/feature/game/slots/slots.component.ts
index a072c27..ff5a086 100644
--- a/frontend/src/app/feature/game/slots/slots.component.ts
+++ b/frontend/src/app/feature/game/slots/slots.component.ts
@@ -1,11 +1,18 @@
-import {ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit, signal,} from '@angular/core';
-import {HttpClient} from '@angular/common/http';
-import {CommonModule, CurrencyPipe, KeyValuePipe, NgClass} from '@angular/common';
-import {FormsModule} from '@angular/forms';
-import {UserService} from '@service/user.service';
-import {Subscription} from 'rxjs';
-import {AnimatedNumberComponent} from '@blackjack/components/animated-number/animated-number.component';
-import {AuthService} from '@service/auth.service';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ inject,
+ OnDestroy,
+ OnInit,
+ signal,
+} from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { CommonModule, CurrencyPipe, KeyValuePipe, NgClass } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+import { UserService } from '@service/user.service';
+import { Subscription } from 'rxjs';
+import { AnimatedNumberComponent } from '@blackjack/components/animated-number/animated-number.component';
+import { AuthService } from '@service/auth.service';
interface SlotResult {
status: 'win' | 'lose' | 'blank' | 'start';
diff --git a/frontend/src/app/feature/home/home.component.ts b/frontend/src/app/feature/home/home.component.ts
index d7edf6f..07b5f9f 100644
--- a/frontend/src/app/feature/home/home.component.ts
+++ b/frontend/src/app/feature/home/home.component.ts
@@ -1,14 +1,14 @@
-import {ChangeDetectionStrategy, Component, inject, OnInit} from '@angular/core';
-import {AsyncPipe, CurrencyPipe, DatePipe, NgFor} from '@angular/common';
-import {DepositComponent} from '../deposit/deposit.component';
-import {ActivatedRoute, Router} from '@angular/router';
-import {ConfirmationComponent} from '@shared/components/confirmation/confirmation.component';
-import {Game} from 'app/model/Game';
-import {Observable} from 'rxjs';
-import {TransactionService} from '@service/transaction.service';
+import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core';
+import { AsyncPipe, CurrencyPipe, DatePipe, NgFor } from '@angular/common';
+import { DepositComponent } from '../deposit/deposit.component';
+import { ActivatedRoute, Router } from '@angular/router';
+import { ConfirmationComponent } from '@shared/components/confirmation/confirmation.component';
+import { Game } from 'app/model/Game';
+import { Observable } from 'rxjs';
+import { TransactionService } from '@service/transaction.service';
import format from 'ajv/dist/vocabularies/format';
-import {TransactionHistoryComponent} from '../transaction-history/transaction-history.component';
-import {TransactionData} from '../../model/TransactionData';
+import { TransactionHistoryComponent } from '../transaction-history/transaction-history.component';
+import { TransactionData } from '../../model/TransactionData';
@Component({
selector: 'app-homepage',
diff --git a/frontend/src/app/feature/landing/landing.component.ts b/frontend/src/app/feature/landing/landing.component.ts
index b12c5d7..9e66baf 100644
--- a/frontend/src/app/feature/landing/landing.component.ts
+++ b/frontend/src/app/feature/landing/landing.component.ts
@@ -1,7 +1,7 @@
-import {ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit} from '@angular/core';
-import {NgFor} from '@angular/common';
-import {RouterLink} from '@angular/router';
-import {AuthService} from '@service/auth.service';
+import { ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit } from '@angular/core';
+import { NgFor } from '@angular/common';
+import { RouterLink } from '@angular/router';
+import { AuthService } from '@service/auth.service';
@Component({
selector: 'app-landing-page',
diff --git a/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.ts b/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.ts
index 2624299..20faa02 100644
--- a/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.ts
+++ b/frontend/src/app/feature/lootboxes/lootbox-opening/lootbox-opening.component.ts
@@ -1,11 +1,11 @@
-import {ChangeDetectorRef, Component} from '@angular/core';
-import {CommonModule} from '@angular/common';
-import {ActivatedRoute, Router} from '@angular/router';
-import {LootboxService} from '../services/lootbox.service';
-import {LootBox, Reward} from 'app/model/LootBox';
-import {UserService} from '@service/user.service';
-import {User} from 'app/model/User';
-import {AuthService} from '@service/auth.service';
+import { ChangeDetectorRef, Component } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { ActivatedRoute, Router } from '@angular/router';
+import { LootboxService } from '../services/lootbox.service';
+import { LootBox, Reward } from 'app/model/LootBox';
+import { UserService } from '@service/user.service';
+import { User } from 'app/model/User';
+import { AuthService } from '@service/auth.service';
@Component({
selector: 'app-lootbox-opening',
diff --git a/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.ts b/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.ts
index cc3e91f..373199b 100644
--- a/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.ts
+++ b/frontend/src/app/feature/lootboxes/lootbox-selection/lootbox-selection.component.ts
@@ -1,12 +1,12 @@
-import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
-import {CommonModule} from '@angular/common';
-import {LootboxService} from '../services/lootbox.service';
-import {LootBox} from 'app/model/LootBox';
-import {Router} from '@angular/router';
-import {timeout} from 'rxjs';
-import {User} from 'app/model/User';
-import {AuthService} from '@service/auth.service';
-import {UserService} from '@service/user.service';
+import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { LootboxService } from '../services/lootbox.service';
+import { LootBox } from 'app/model/LootBox';
+import { Router } from '@angular/router';
+import { timeout } from 'rxjs';
+import { User } from 'app/model/User';
+import { AuthService } from '@service/auth.service';
+import { UserService } from '@service/user.service';
@Component({
selector: 'app-lootbox-selection',
diff --git a/frontend/src/app/feature/transaction-history/transaction-history.component.ts b/frontend/src/app/feature/transaction-history/transaction-history.component.ts
index b0e12f8..338ef4e 100644
--- a/frontend/src/app/feature/transaction-history/transaction-history.component.ts
+++ b/frontend/src/app/feature/transaction-history/transaction-history.component.ts
@@ -1,8 +1,15 @@
-import {ChangeDetectionStrategy, Component, EventEmitter, inject, Input, Output,} from '@angular/core';
-import {TransactionService} from '@service/transaction.service';
-import {Observable} from 'rxjs';
-import {AsyncPipe, CurrencyPipe, DatePipe, NgIf} from '@angular/common';
-import {TransactionData} from '../../model/TransactionData';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ EventEmitter,
+ inject,
+ Input,
+ Output,
+} from '@angular/core';
+import { TransactionService } from '@service/transaction.service';
+import { Observable } from 'rxjs';
+import { AsyncPipe, CurrencyPipe, DatePipe, NgIf } from '@angular/common';
+import { TransactionData } from '../../model/TransactionData';
const PER_PAGE = 5;
From 2995065dfd02613dda3596a5f3dfbd5120bb5b76 Mon Sep 17 00:00:00 2001
From: jank
Date: Wed, 14 May 2025 09:37:41 +0200
Subject: [PATCH 020/225] fix: Add needs
---
.gitea/workflows/ci.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml
index e33246b..63577d8 100644
--- a/.gitea/workflows/ci.yml
+++ b/.gitea/workflows/ci.yml
@@ -77,6 +77,7 @@ jobs:
validate-docker-frontend:
runs-on: ubuntu-latest
name: Docker frontend validation
+ needs: changed_files
if: ${{ needs.changed_files.outputs.frontend == 'true' || needs.changed_files.outputs.workflow == 'true' }}
container:
image: catthehacker/ubuntu:act-latest
@@ -93,6 +94,7 @@ jobs:
validate-docker-backend:
runs-on: ubuntu-latest
name: Docker backend validation
+ needs: changed_files
if: ${{ needs.changed_files.outputs.backend == 'true' || needs.changed_files.outputs.workflow == 'true' }}
container:
image: catthehacker/ubuntu:act-latest
From 5f9d60d3328afd6b2a598818cc95cc387ab4860f Mon Sep 17 00:00:00 2001
From: Phan Huy Tran
Date: Wed, 14 May 2025 09:53:17 +0200
Subject: [PATCH 021/225] refactor: immediately display login error
---
.../feature/auth/login/login.component.html | 40 ++++++++++---------
.../app/feature/auth/login/login.component.ts | 24 +++++------
2 files changed, 33 insertions(+), 31 deletions(-)
diff --git a/frontend/src/app/feature/auth/login/login.component.html b/frontend/src/app/feature/auth/login/login.component.html
index c10b232..40fc3e6 100644
--- a/frontend/src/app/feature/auth/login/login.component.html
+++ b/frontend/src/app/feature/auth/login/login.component.html
@@ -2,9 +2,11 @@
Anmelden
-
- {{ errorMessage }}
-
+ @if (errorMessage()) {
+
+ {{ errorMessage() }}
+
+ }
diff --git a/frontend/src/app/feature/auth/login/login.component.ts b/frontend/src/app/feature/auth/login/login.component.ts
index 1ed3537..8143e15 100644
--- a/frontend/src/app/feature/auth/login/login.component.ts
+++ b/frontend/src/app/feature/auth/login/login.component.ts
@@ -1,9 +1,9 @@
-import { Component } from '@angular/core';
-import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
-import { Router, RouterLink } from '@angular/router';
-import { LoginRequest } from '../../../model/auth/LoginRequest';
-import { AuthService } from '../../../service/auth.service';
-import { CommonModule } from '@angular/common';
+import {Component, signal} from '@angular/core';
+import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
+import {Router, RouterLink} from '@angular/router';
+import {LoginRequest} from '../../../model/auth/LoginRequest';
+import {AuthService} from '@service/auth.service';
+import {CommonModule} from '@angular/common';
@Component({
selector: 'app-login',
@@ -13,8 +13,8 @@ import { CommonModule } from '@angular/common';
})
export class LoginComponent {
loginForm: FormGroup;
- errorMessage = '';
- isLoading = false;
+ errorMessage = signal('');
+ isLoading = signal(false);
constructor(
private fb: FormBuilder,
@@ -36,8 +36,8 @@ export class LoginComponent {
return;
}
- this.isLoading = true;
- this.errorMessage = '';
+ this.isLoading.set(true);
+ this.errorMessage.set('');
const loginRequest: LoginRequest = {
usernameOrEmail: this.form['usernameOrEmail'].value,
@@ -49,8 +49,8 @@ export class LoginComponent {
this.router.navigate(['/home']);
},
error: (err) => {
- this.isLoading = false;
- this.errorMessage = err.error?.message || 'Failed to login. Please check your credentials.';
+ this.isLoading.set(false);
+ this.errorMessage.set(err.error?.message || 'Failed to login. Please check your credentials.');
},
});
}
From 64b2e28566aa4cdc94f8f1544498e630fde76ae2 Mon Sep 17 00:00:00 2001
From: Phan Huy Tran
Date: Wed, 14 May 2025 09:54:12 +0200
Subject: [PATCH 022/225] style: run quality tools
---
.../app/feature/auth/login/login.component.ts | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/frontend/src/app/feature/auth/login/login.component.ts b/frontend/src/app/feature/auth/login/login.component.ts
index 8143e15..8874dbc 100644
--- a/frontend/src/app/feature/auth/login/login.component.ts
+++ b/frontend/src/app/feature/auth/login/login.component.ts
@@ -1,9 +1,9 @@
-import {Component, signal} from '@angular/core';
-import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
-import {Router, RouterLink} from '@angular/router';
-import {LoginRequest} from '../../../model/auth/LoginRequest';
-import {AuthService} from '@service/auth.service';
-import {CommonModule} from '@angular/common';
+import { Component, signal } from '@angular/core';
+import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
+import { Router, RouterLink } from '@angular/router';
+import { LoginRequest } from '../../../model/auth/LoginRequest';
+import { AuthService } from '@service/auth.service';
+import { CommonModule } from '@angular/common';
@Component({
selector: 'app-login',
@@ -50,7 +50,9 @@ export class LoginComponent {
},
error: (err) => {
this.isLoading.set(false);
- this.errorMessage.set(err.error?.message || 'Failed to login. Please check your credentials.');
+ this.errorMessage.set(
+ err.error?.message || 'Failed to login. Please check your credentials.'
+ );
},
});
}
From 48119d1faf312cde02adfd7e5a33b77fcc150337 Mon Sep 17 00:00:00 2001
From: jank
Date: Wed, 14 May 2025 10:00:45 +0200
Subject: [PATCH 023/225] fix: Add concurrency rules
---
.gitea/workflows/ci.yml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml
index 63577d8..7742416 100644
--- a/.gitea/workflows/ci.yml
+++ b/.gitea/workflows/ci.yml
@@ -3,6 +3,10 @@ name: CI
on:
pull_request:
+concurrency:
+ group: ci-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
changed_files:
name: Get Changed Files
From b4351ceaea4d7919d98ea0b47bf15b5cd536cf62 Mon Sep 17 00:00:00 2001
From: Phan Huy Tran
Date: Wed, 14 May 2025 10:32:44 +0200
Subject: [PATCH 024/225] refactor: throw proper error on registration
conflict, handle properly
---
.../GlobalExceptionHandler.java | 7 ++
.../java/de/szut/casino/user/UserService.java | 5 +-
.../auth/register/register.component.html | 83 ++++++++++++-------
.../auth/register/register.component.ts | 43 +++++++---
4 files changed, 93 insertions(+), 45 deletions(-)
diff --git a/backend/src/main/java/de/szut/casino/exceptionHandling/GlobalExceptionHandler.java b/backend/src/main/java/de/szut/casino/exceptionHandling/GlobalExceptionHandler.java
index df20fe0..573abb8 100644
--- a/backend/src/main/java/de/szut/casino/exceptionHandling/GlobalExceptionHandler.java
+++ b/backend/src/main/java/de/szut/casino/exceptionHandling/GlobalExceptionHandler.java
@@ -2,6 +2,7 @@ package de.szut.casino.exceptionHandling;
import de.szut.casino.exceptionHandling.exceptions.InsufficientFundsException;
import de.szut.casino.exceptionHandling.exceptions.UserNotFoundException;
+import jakarta.persistence.EntityExistsException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
@@ -24,4 +25,10 @@ public class GlobalExceptionHandler {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST);
}
+
+ @ExceptionHandler(EntityExistsException.class)
+ public ResponseEntity> handleEntityExistsException(EntityExistsException ex, WebRequest request) {
+ ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
+ return new ResponseEntity<>(errorDetails, HttpStatus.CONFLICT);
+ }
}
diff --git a/backend/src/main/java/de/szut/casino/user/UserService.java b/backend/src/main/java/de/szut/casino/user/UserService.java
index f74bff9..25fabef 100644
--- a/backend/src/main/java/de/szut/casino/user/UserService.java
+++ b/backend/src/main/java/de/szut/casino/user/UserService.java
@@ -1,6 +1,7 @@
package de.szut.casino.user;
import de.szut.casino.user.dto.CreateUserDto;
+import jakarta.persistence.EntityExistsException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.password.PasswordEncoder;
@@ -19,11 +20,11 @@ public class UserService {
public UserEntity createUser(CreateUserDto createUserDto) {
if (userRepository.existsByUsername(createUserDto.getUsername())) {
- throw new IllegalArgumentException("Username is already taken");
+ throw new EntityExistsException("Username is already taken");
}
if (userRepository.existsByEmail(createUserDto.getEmail())) {
- throw new IllegalArgumentException("Email is already in use");
+ throw new EntityExistsException("Email is already in use");
}
UserEntity user = new UserEntity(
diff --git a/frontend/src/app/feature/auth/register/register.component.html b/frontend/src/app/feature/auth/register/register.component.html
index 29794c9..5339e36 100644
--- a/frontend/src/app/feature/auth/register/register.component.html
+++ b/frontend/src/app/feature/auth/register/register.component.html
@@ -2,9 +2,11 @@
Konto erstellen
-
- {{ errorMessage }}
-
+ @if (errorMessage()) {
+
+ {{ errorMessage() }}
+
+ }
diff --git a/frontend/src/app/feature/auth/register/register.component.ts b/frontend/src/app/feature/auth/register/register.component.ts
index 22a032f..a916388 100644
--- a/frontend/src/app/feature/auth/register/register.component.ts
+++ b/frontend/src/app/feature/auth/register/register.component.ts
@@ -1,9 +1,10 @@
-import { Component } from '@angular/core';
+import { Component, signal } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { Router, RouterLink } from '@angular/router';
import { RegisterRequest } from '../../../model/auth/RegisterRequest';
import { AuthService } from '@service/auth.service';
import { CommonModule } from '@angular/common';
+import { HttpErrorResponse } from '@angular/common/http';
@Component({
selector: 'app-register',
@@ -13,8 +14,9 @@ import { CommonModule } from '@angular/common';
})
export class RegisterComponent {
registerForm: FormGroup;
- errorMessage = '';
- isLoading = false;
+ errorMessage = signal
('');
+ isLoading = signal(false);
+ fieldErrors = signal<{ [key: string]: string }>({});
constructor(
private fb: FormBuilder,
@@ -37,8 +39,9 @@ export class RegisterComponent {
return;
}
- this.isLoading = true;
- this.errorMessage = '';
+ this.isLoading.set(true);
+ this.errorMessage.set('');
+ this.fieldErrors.set({});
const registerRequest: RegisterRequest = {
email: this.form['email'].value,
@@ -59,15 +62,33 @@ export class RegisterComponent {
this.router.navigate(['/home']);
},
error: () => {
- this.isLoading = false;
- this.errorMessage =
- 'Registration successful but failed to login automatically. Please log in manually.';
+ this.isLoading.set(false);
+ this.errorMessage.set(
+ 'Registration successful but failed to login automatically. Please log in manually.'
+ );
},
});
},
- error: (err) => {
- this.isLoading = false;
- this.errorMessage = err.error?.message || 'Failed to register. Please try again.';
+ error: (err: HttpErrorResponse) => {
+ this.isLoading.set(false);
+
+ if (err.status === 409) {
+ const errorResponse = err.error;
+
+ if (errorResponse?.message === 'Email is already in use') {
+ this.fieldErrors.update((errors) => ({
+ ...errors,
+ email: 'Diese E-Mail-Adresse wird bereits verwendet.',
+ }));
+ } else if (errorResponse?.message === 'Username is already taken') {
+ this.fieldErrors.update((errors) => ({
+ ...errors,
+ username: 'Dieser Benutzername ist bereits vergeben.',
+ }));
+ }
+ } else {
+ this.errorMessage.set(err.error?.message || 'Failed to register. Please try again.');
+ }
},
});
}
From e7e43839eb3de8ffb29b63472dbe17fc83643519 Mon Sep 17 00:00:00 2001
From: Phan Huy Tran
Date: Wed, 14 May 2025 10:37:08 +0200
Subject: [PATCH 025/225] refactor: fix linter, adjust errorhandling
---
.../auth/register/register.component.ts | 29 ++++++++++---------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/frontend/src/app/feature/auth/register/register.component.ts b/frontend/src/app/feature/auth/register/register.component.ts
index a916388..4b240f5 100644
--- a/frontend/src/app/feature/auth/register/register.component.ts
+++ b/frontend/src/app/feature/auth/register/register.component.ts
@@ -16,7 +16,7 @@ export class RegisterComponent {
registerForm: FormGroup;
errorMessage = signal('');
isLoading = signal(false);
- fieldErrors = signal<{ [key: string]: string }>({});
+ fieldErrors = signal>({});
constructor(
private fb: FormBuilder,
@@ -51,7 +51,6 @@ export class RegisterComponent {
this.authService.register(registerRequest).subscribe({
next: () => {
- // After registration, log in the user
this.authService
.login({
usernameOrEmail: registerRequest.email,
@@ -73,18 +72,20 @@ export class RegisterComponent {
this.isLoading.set(false);
if (err.status === 409) {
- const errorResponse = err.error;
-
- if (errorResponse?.message === 'Email is already in use') {
- this.fieldErrors.update((errors) => ({
- ...errors,
- email: 'Diese E-Mail-Adresse wird bereits verwendet.',
- }));
- } else if (errorResponse?.message === 'Username is already taken') {
- this.fieldErrors.update((errors) => ({
- ...errors,
- username: 'Dieser Benutzername ist bereits vergeben.',
- }));
+ const message = err.error?.message;
+ switch (message) {
+ case 'Email is already in use':
+ this.fieldErrors.update(errors => ({
+ ...errors,
+ email: 'Diese E-Mail-Adresse wird bereits verwendet.'
+ }));
+ break;
+ case 'Username is already taken':
+ this.fieldErrors.update(errors => ({
+ ...errors,
+ username: 'Dieser Benutzername ist bereits vergeben.'
+ }));
+ break;
}
} else {
this.errorMessage.set(err.error?.message || 'Failed to register. Please try again.');
From 0bab8a343c2ee48a1fac65f42f6406b89d309ddd Mon Sep 17 00:00:00 2001
From: Phan Huy Tran
Date: Wed, 14 May 2025 10:40:32 +0200
Subject: [PATCH 026/225] style: run prettier
---
.../src/app/feature/auth/register/register.component.ts | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/frontend/src/app/feature/auth/register/register.component.ts b/frontend/src/app/feature/auth/register/register.component.ts
index 4b240f5..1ccc15c 100644
--- a/frontend/src/app/feature/auth/register/register.component.ts
+++ b/frontend/src/app/feature/auth/register/register.component.ts
@@ -75,15 +75,15 @@ export class RegisterComponent {
const message = err.error?.message;
switch (message) {
case 'Email is already in use':
- this.fieldErrors.update(errors => ({
+ this.fieldErrors.update((errors) => ({
...errors,
- email: 'Diese E-Mail-Adresse wird bereits verwendet.'
+ email: 'Diese E-Mail-Adresse wird bereits verwendet.',
}));
break;
case 'Username is already taken':
- this.fieldErrors.update(errors => ({
+ this.fieldErrors.update((errors) => ({
...errors,
- username: 'Dieser Benutzername ist bereits vergeben.'
+ username: 'Dieser Benutzername ist bereits vergeben.',
}));
break;
}
From bee6fabcfaefa2fb23e012d75310455e3c79330e Mon Sep 17 00:00:00 2001
From: Phan Huy Tran
Date: Wed, 14 May 2025 11:30:40 +0200
Subject: [PATCH 027/225] fix: protect slots route
---
frontend/src/app/app.routes.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/frontend/src/app/app.routes.ts b/frontend/src/app/app.routes.ts
index 7958ffb..a22eec9 100644
--- a/frontend/src/app/app.routes.ts
+++ b/frontend/src/app/app.routes.ts
@@ -30,6 +30,7 @@ export const routes: Routes = [
{
path: 'game/slots',
loadComponent: () => import('./feature/game/slots/slots.component'),
+ canActivate: [authGuard]
},
{
path: 'game/lootboxes',
From 03bee953da7997f41bbcaa0acd993b04d60a08e4 Mon Sep 17 00:00:00 2001
From: Phan Huy Tran
Date: Wed, 14 May 2025 11:45:51 +0200
Subject: [PATCH 028/225] style: prettier
---
frontend/src/app/app.routes.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/app/app.routes.ts b/frontend/src/app/app.routes.ts
index a22eec9..86ce3d4 100644
--- a/frontend/src/app/app.routes.ts
+++ b/frontend/src/app/app.routes.ts
@@ -30,7 +30,7 @@ export const routes: Routes = [
{
path: 'game/slots',
loadComponent: () => import('./feature/game/slots/slots.component'),
- canActivate: [authGuard]
+ canActivate: [authGuard],
},
{
path: 'game/lootboxes',
From 0079ee7bf278c0a3761e9321eabeb5cba407dbe1 Mon Sep 17 00:00:00 2001
From: Jan-Marlon Leibl
Date: Wed, 14 May 2025 12:00:33 +0200
Subject: [PATCH 029/225] feat(auth): add login and registration modal
functionality
---
frontend/src/app/app.component.html | 40 +++++++++++++-
frontend/src/app/app.component.ts | 46 ++++++++++++----
frontend/src/app/app.routes.ts | 10 ----
.../feature/auth/login/login.component.html | 19 +++++--
.../app/feature/auth/login/login.component.ts | 13 +++--
.../auth/register/register.component.html | 19 +++++--
.../auth/register/register.component.ts | 12 +++--
.../feature/landing/landing.component.html | 53 +++++++++++++++----
.../app/feature/landing/landing.component.ts | 28 +++++++++-
.../components/navbar/navbar.component.html | 22 ++++----
.../components/navbar/navbar.component.ts | 5 ++
11 files changed, 212 insertions(+), 55 deletions(-)
diff --git a/frontend/src/app/app.component.html b/frontend/src/app/app.component.html
index 2e3cd9a..2b9d140 100644
--- a/frontend/src/app/app.component.html
+++ b/frontend/src/app/app.component.html
@@ -1,7 +1,45 @@
-
+
+
+
+ @if (showLogin() || showRegister()) {
+
+
+
+ @if (showLogin()) {
+
+ }
+ @if (showRegister()) {
+
+ }
+
+
+ }
diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts
index 3e25d5b..52c1fc3 100644
--- a/frontend/src/app/app.component.ts
+++ b/frontend/src/app/app.component.ts
@@ -1,16 +1,44 @@
-import { ChangeDetectionStrategy, Component } from '@angular/core';
-import { CommonModule } from '@angular/common';
+import { Component, HostListener, signal } from '@angular/core';
import { RouterOutlet } from '@angular/router';
-import { FooterComponent } from '@shared/components/footer/footer.component';
-import { NavbarComponent } from '@shared/components/navbar/navbar.component';
+import { NavbarComponent } from './shared/components/navbar/navbar.component';
+import { FooterComponent } from './shared/components/footer/footer.component';
+import { LoginComponent } from './feature/auth/login/login.component';
+import { RegisterComponent } from './feature/auth/register/register.component';
@Component({
selector: 'app-root',
standalone: true,
- imports: [CommonModule, RouterOutlet, FooterComponent, NavbarComponent],
- providers: [],
+ imports: [RouterOutlet, NavbarComponent, FooterComponent, LoginComponent, RegisterComponent],
templateUrl: './app.component.html',
- styleUrl: './app.component.css',
- changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class AppComponent {}
+export class AppComponent {
+ showLogin = signal(false);
+ showRegister = signal(false);
+
+ @HostListener('document:keydown.escape')
+ handleEscapeKey() {
+ this.hideAuthForms();
+ }
+
+ showLoginForm() {
+ this.showLogin.set(true);
+ this.showRegister.set(false);
+ document.body.style.overflow = 'hidden';
+ }
+
+ showRegisterForm() {
+ this.showRegister.set(true);
+ this.showLogin.set(false);
+ document.body.style.overflow = 'hidden';
+ }
+
+ hideAuthForms() {
+ this.showLogin.set(false);
+ this.showRegister.set(false);
+ document.body.style.overflow = 'auto';
+ }
+
+ stopPropagation(event: MouseEvent) {
+ event.stopPropagation();
+ }
+}
diff --git a/frontend/src/app/app.routes.ts b/frontend/src/app/app.routes.ts
index 86ce3d4..3792038 100644
--- a/frontend/src/app/app.routes.ts
+++ b/frontend/src/app/app.routes.ts
@@ -7,16 +7,6 @@ export const routes: Routes = [
path: '',
component: LandingComponent,
},
- {
- path: 'login',
- loadComponent: () =>
- import('./feature/auth/login/login.component').then((m) => m.LoginComponent),
- },
- {
- path: 'register',
- loadComponent: () =>
- import('./feature/auth/register/register.component').then((m) => m.RegisterComponent),
- },
{
path: 'home',
loadComponent: () => import('./feature/home/home.component'),
diff --git a/frontend/src/app/feature/auth/login/login.component.html b/frontend/src/app/feature/auth/login/login.component.html
index 40fc3e6..9017a95 100644
--- a/frontend/src/app/feature/auth/login/login.component.html
+++ b/frontend/src/app/feature/auth/login/login.component.html
@@ -1,5 +1,16 @@
-
+
+
+
+
Anmelden
@if (errorMessage()) {
@@ -65,12 +76,12 @@
Noch kein Konto?
-
Registrieren
-
+
diff --git a/frontend/src/app/feature/auth/login/login.component.ts b/frontend/src/app/feature/auth/login/login.component.ts
index 8874dbc..b5a67a0 100644
--- a/frontend/src/app/feature/auth/login/login.component.ts
+++ b/frontend/src/app/feature/auth/login/login.component.ts
@@ -1,6 +1,6 @@
-import { Component, signal } from '@angular/core';
+import { Component, EventEmitter, Output, signal } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
-import { Router, RouterLink } from '@angular/router';
+import { Router } from '@angular/router';
import { LoginRequest } from '../../../model/auth/LoginRequest';
import { AuthService } from '@service/auth.service';
import { CommonModule } from '@angular/common';
@@ -8,13 +8,15 @@ import { CommonModule } from '@angular/common';
@Component({
selector: 'app-login',
standalone: true,
- imports: [CommonModule, ReactiveFormsModule, RouterLink],
+ imports: [CommonModule, ReactiveFormsModule],
templateUrl: './login.component.html',
})
export class LoginComponent {
loginForm: FormGroup;
errorMessage = signal('');
isLoading = signal(false);
+ @Output() switchForm = new EventEmitter
();
+ @Output() closeDialog = new EventEmitter();
constructor(
private fb: FormBuilder,
@@ -31,6 +33,10 @@ export class LoginComponent {
return this.loginForm.controls;
}
+ switchToRegister(): void {
+ this.switchForm.emit();
+ }
+
onSubmit(): void {
if (this.loginForm.invalid) {
return;
@@ -46,6 +52,7 @@ export class LoginComponent {
this.authService.login(loginRequest).subscribe({
next: () => {
+ this.closeDialog.emit();
this.router.navigate(['/home']);
},
error: (err) => {
diff --git a/frontend/src/app/feature/auth/register/register.component.html b/frontend/src/app/feature/auth/register/register.component.html
index 5339e36..d099bf9 100644
--- a/frontend/src/app/feature/auth/register/register.component.html
+++ b/frontend/src/app/feature/auth/register/register.component.html
@@ -1,5 +1,16 @@
-
+
+
+
+
Konto erstellen
@if (errorMessage()) {
@@ -107,12 +118,12 @@
Bereits ein Konto?
-
Anmelden
-
+
diff --git a/frontend/src/app/feature/auth/register/register.component.ts b/frontend/src/app/feature/auth/register/register.component.ts
index 1ccc15c..7a3e381 100644
--- a/frontend/src/app/feature/auth/register/register.component.ts
+++ b/frontend/src/app/feature/auth/register/register.component.ts
@@ -1,6 +1,6 @@
-import { Component, signal } from '@angular/core';
+import { Component, EventEmitter, Output, signal } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
-import { Router, RouterLink } from '@angular/router';
+import { Router } from '@angular/router';
import { RegisterRequest } from '../../../model/auth/RegisterRequest';
import { AuthService } from '@service/auth.service';
import { CommonModule } from '@angular/common';
@@ -9,7 +9,7 @@ import { HttpErrorResponse } from '@angular/common/http';
@Component({
selector: 'app-register',
standalone: true,
- imports: [CommonModule, ReactiveFormsModule, RouterLink],
+ imports: [CommonModule, ReactiveFormsModule],
templateUrl: './register.component.html',
})
export class RegisterComponent {
@@ -17,6 +17,8 @@ export class RegisterComponent {
errorMessage = signal
('');
isLoading = signal(false);
fieldErrors = signal>({});
+ @Output() switchForm = new EventEmitter();
+ @Output() closeDialog = new EventEmitter();
constructor(
private fb: FormBuilder,
@@ -34,6 +36,10 @@ export class RegisterComponent {
return this.registerForm.controls;
}
+ switchToLogin(): void {
+ this.switchForm.emit();
+ }
+
onSubmit(): void {
if (this.registerForm.invalid) {
return;
diff --git a/frontend/src/app/feature/landing/landing.component.html b/frontend/src/app/feature/landing/landing.component.html
index aa411fd..cac12a1 100644
--- a/frontend/src/app/feature/landing/landing.component.html
+++ b/frontend/src/app/feature/landing/landing.component.html
@@ -1,4 +1,4 @@
-
+
@@ -120,8 +120,8 @@
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
fill="none"
- viewBox="0 0 24 24"
stroke="currentColor"
+ viewBox="0 0 24 24"
>
+
+
+ @if (showLogin() || showRegister()) {
+
+
+
+ @if (showLogin()) {
+
+ }
+ @if (showRegister()) {
+
+ }
+
+
+ }
diff --git a/frontend/src/app/feature/landing/landing.component.ts b/frontend/src/app/feature/landing/landing.component.ts
index 9e66baf..ee9615a 100644
--- a/frontend/src/app/feature/landing/landing.component.ts
+++ b/frontend/src/app/feature/landing/landing.component.ts
@@ -1,12 +1,14 @@
-import { ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit } from '@angular/core';
+import { ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit, signal } from '@angular/core';
import { NgFor } from '@angular/common';
import { RouterLink } from '@angular/router';
import { AuthService } from '@service/auth.service';
+import { LoginComponent } from '../auth/login/login.component';
+import { RegisterComponent } from '../auth/register/register.component';
@Component({
selector: 'app-landing-page',
standalone: true,
- imports: [NgFor, RouterLink],
+ imports: [NgFor, RouterLink, LoginComponent, RegisterComponent],
templateUrl: './landing.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
@@ -14,13 +16,35 @@ export class LandingComponent implements OnInit, OnDestroy {
currentSlide = 0;
private autoplayInterval: ReturnType | undefined;
authService: AuthService = inject(AuthService);
+ showLogin = signal(false);
+ showRegister = signal(false);
ngOnInit() {
this.startAutoplay();
+ document.body.style.overflow = 'auto';
}
ngOnDestroy() {
this.stopAutoplay();
+ document.body.style.overflow = 'auto';
+ }
+
+ showLoginForm() {
+ this.showLogin.set(true);
+ this.showRegister.set(false);
+ document.body.style.overflow = 'hidden';
+ }
+
+ showRegisterForm() {
+ this.showRegister.set(true);
+ this.showLogin.set(false);
+ document.body.style.overflow = 'hidden';
+ }
+
+ hideAuthForms() {
+ this.showLogin.set(false);
+ this.showRegister.set(false);
+ document.body.style.overflow = 'auto';
}
prevSlide() {
diff --git a/frontend/src/app/shared/components/navbar/navbar.component.html b/frontend/src/app/shared/components/navbar/navbar.component.html
index 749437f..cadb7f6 100644
--- a/frontend/src/app/shared/components/navbar/navbar.component.html
+++ b/frontend/src/app/shared/components/navbar/navbar.component.html
@@ -12,12 +12,13 @@
@if (!isLoggedIn()) {
-
Anmelden
-
Anmelden
+
+ Registrieren
+
}
@if (isLoggedIn()) {
Spiele
@if (!isLoggedIn()) {
-
Anmelden
-
+ Anmelden
+
+
+ Registrieren
+
}
@if (isLoggedIn()) {
diff --git a/frontend/src/app/shared/components/navbar/navbar.component.ts b/frontend/src/app/shared/components/navbar/navbar.component.ts
index 8f646f5..7b8bb63 100644
--- a/frontend/src/app/shared/components/navbar/navbar.component.ts
+++ b/frontend/src/app/shared/components/navbar/navbar.component.ts
@@ -1,9 +1,11 @@
import {
ChangeDetectionStrategy,
Component,
+ EventEmitter,
inject,
OnDestroy,
OnInit,
+ Output,
signal,
} from '@angular/core';
import { RouterModule } from '@angular/router';
@@ -26,6 +28,9 @@ export class NavbarComponent implements OnInit, OnDestroy {
private authSubscription!: Subscription;
public balance = signal(0);
+ @Output() showLogin = new EventEmitter
();
+ @Output() showRegister = new EventEmitter();
+
ngOnInit() {
this.authSubscription = this.authService.userSubject.subscribe({
next: (user) => {
From b51305ca647a874afd59ffe2fe8e53f9a5acc810 Mon Sep 17 00:00:00 2001
From: Jan-Marlon Leibl
Date: Wed, 14 May 2025 12:01:06 +0200
Subject: [PATCH 030/225] style: format HTML for consistency and readability
---
frontend/src/app/app.component.html | 27 +++++--------------
.../feature/auth/login/login.component.html | 17 +++++++++---
.../auth/register/register.component.html | 17 +++++++++---
.../feature/landing/landing.component.html | 22 +++++----------
.../app/feature/landing/landing.component.ts | 9 ++++++-
.../components/navbar/navbar.component.html | 5 +++-
6 files changed, 53 insertions(+), 44 deletions(-)
diff --git a/frontend/src/app/app.component.html b/frontend/src/app/app.component.html
index 2b9d140..497522a 100644
--- a/frontend/src/app/app.component.html
+++ b/frontend/src/app/app.component.html
@@ -1,40 +1,27 @@
-
+
@if (showLogin() || showRegister()) {
-
-
-
+
+
@if (showLogin()) {
-
+
}
@if (showRegister()) {
-
diff --git a/frontend/src/app/feature/auth/login/login.component.html b/frontend/src/app/feature/auth/login/login.component.html
index 9017a95..63df987 100644
--- a/frontend/src/app/feature/auth/login/login.component.html
+++ b/frontend/src/app/feature/auth/login/login.component.html
@@ -1,13 +1,24 @@
-
diff --git a/frontend/src/app/feature/auth/register/register.component.html b/frontend/src/app/feature/auth/register/register.component.html
index d099bf9..0b6713a 100644
--- a/frontend/src/app/feature/auth/register/register.component.html
+++ b/frontend/src/app/feature/auth/register/register.component.html
@@ -1,13 +1,24 @@
-
diff --git a/frontend/src/app/feature/landing/landing.component.html b/frontend/src/app/feature/landing/landing.component.html
index cac12a1..03b138f 100644
--- a/frontend/src/app/feature/landing/landing.component.html
+++ b/frontend/src/app/feature/landing/landing.component.html
@@ -184,31 +184,21 @@
@if (showLogin() || showRegister()) {
-
-
-
+
+
@if (showLogin()) {
-
+
}
@if (showRegister()) {
-
diff --git a/frontend/src/app/feature/landing/landing.component.ts b/frontend/src/app/feature/landing/landing.component.ts
index ee9615a..d4d6078 100644
--- a/frontend/src/app/feature/landing/landing.component.ts
+++ b/frontend/src/app/feature/landing/landing.component.ts
@@ -1,4 +1,11 @@
-import { ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit, signal } from '@angular/core';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ inject,
+ OnDestroy,
+ OnInit,
+ signal,
+} from '@angular/core';
import { NgFor } from '@angular/common';
import { RouterLink } from '@angular/router';
import { AuthService } from '@service/auth.service';
diff --git a/frontend/src/app/shared/components/navbar/navbar.component.html b/frontend/src/app/shared/components/navbar/navbar.component.html
index cadb7f6..7e010fa 100644
--- a/frontend/src/app/shared/components/navbar/navbar.component.html
+++ b/frontend/src/app/shared/components/navbar/navbar.component.html
@@ -72,7 +72,10 @@
Spiele
@if (!isLoggedIn()) {
-