style: fix formatting and add missing commas in code
All checks were successful
CI / Get Changed Files (pull_request) Successful in 18s
CI / Checkstyle Main (pull_request) Has been skipped
CI / Docker backend validation (pull_request) Successful in 15s
CI / Docker frontend validation (pull_request) Successful in 52s
CI / oxlint (pull_request) Successful in 29s
CI / eslint (pull_request) Successful in 38s
CI / prettier (pull_request) Successful in 30s
CI / test-build (pull_request) Successful in 46s
All checks were successful
CI / Get Changed Files (pull_request) Successful in 18s
CI / Checkstyle Main (pull_request) Has been skipped
CI / Docker backend validation (pull_request) Successful in 15s
CI / Docker frontend validation (pull_request) Successful in 52s
CI / oxlint (pull_request) Successful in 29s
CI / eslint (pull_request) Successful in 38s
CI / prettier (pull_request) Successful in 30s
CI / test-build (pull_request) Successful in 46s
This commit is contained in:
parent
790485decc
commit
c92a182123
6 changed files with 21 additions and 21 deletions
|
@ -34,7 +34,7 @@
|
||||||
[disabled]="!hasEnoughBalance()"
|
[disabled]="!hasEnoughBalance()"
|
||||||
[ngClass]="{
|
[ngClass]="{
|
||||||
'button-primary': hasEnoughBalance(),
|
'button-primary': hasEnoughBalance(),
|
||||||
'bg-gray-500 cursor-not-allowed': !hasEnoughBalance()
|
'bg-gray-500 cursor-not-allowed': !hasEnoughBalance(),
|
||||||
}"
|
}"
|
||||||
class="w-full py-3 text-lg font-semibold rounded"
|
class="w-full py-3 text-lg font-semibold rounded"
|
||||||
>
|
>
|
||||||
|
@ -91,14 +91,14 @@
|
||||||
class="flex justify-center gap-4 mt-8 animation-fade"
|
class="flex justify-center gap-4 mt-8 animation-fade"
|
||||||
[class.visible]="animationCompleted"
|
[class.visible]="animationCompleted"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
(click)="openAgain()"
|
(click)="openAgain()"
|
||||||
[disabled]="!animationCompleted || !hasEnoughBalance()"
|
[disabled]="!animationCompleted || !hasEnoughBalance()"
|
||||||
[ngClass]="{
|
[ngClass]="{
|
||||||
'button-primary': hasEnoughBalance(),
|
'button-primary': hasEnoughBalance(),
|
||||||
'bg-gray-500 cursor-not-allowed': !hasEnoughBalance()
|
'bg-gray-500 cursor-not-allowed': !hasEnoughBalance(),
|
||||||
}"
|
}"
|
||||||
class="px-6 py-2 font-semibold rounded"
|
class="px-6 py-2 font-semibold rounded"
|
||||||
[attr.aria-hidden]="!animationCompleted"
|
[attr.aria-hidden]="!animationCompleted"
|
||||||
>
|
>
|
||||||
<span *ngIf="hasEnoughBalance()">Nochmal Öffnen</span>
|
<span *ngIf="hasEnoughBalance()">Nochmal Öffnen</span>
|
||||||
|
|
|
@ -33,7 +33,7 @@ export default class LootboxOpeningComponent {
|
||||||
private cdr: ChangeDetectorRef
|
private cdr: ChangeDetectorRef
|
||||||
) {
|
) {
|
||||||
this.loadLootbox();
|
this.loadLootbox();
|
||||||
this.userService.currentUser$.subscribe(user => {
|
this.userService.currentUser$.subscribe((user) => {
|
||||||
this.currentUser = user;
|
this.currentUser = user;
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
});
|
});
|
||||||
|
@ -64,7 +64,7 @@ export default class LootboxOpeningComponent {
|
||||||
|
|
||||||
openLootbox(): void {
|
openLootbox(): void {
|
||||||
if (!this.lootbox || this.isOpening) return;
|
if (!this.lootbox || this.isOpening) return;
|
||||||
|
|
||||||
// Check if user has enough balance
|
// Check if user has enough balance
|
||||||
if (!this.hasEnoughBalance()) {
|
if (!this.hasEnoughBalance()) {
|
||||||
this.error = 'Nicht genug Guthaben, um diese Lootbox zu öffnen.';
|
this.error = 'Nicht genug Guthaben, um diese Lootbox zu öffnen.';
|
||||||
|
@ -78,7 +78,7 @@ export default class LootboxOpeningComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resetState(true);
|
this.resetState(true);
|
||||||
|
|
||||||
if (this.lootbox.price) {
|
if (this.lootbox.price) {
|
||||||
this.userService.updateLocalBalance(-this.lootbox.price);
|
this.userService.updateLocalBalance(-this.lootbox.price);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ export default class LootboxOpeningComponent {
|
||||||
this.generateCasePrizes(reward);
|
this.generateCasePrizes(reward);
|
||||||
this.isOpening = false;
|
this.isOpening = false;
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
|
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ export default class LootboxOpeningComponent {
|
||||||
|
|
||||||
const rewards = this.lootbox.rewards;
|
const rewards = this.lootbox.rewards;
|
||||||
const fallback = rewards[Math.floor(Math.random() * rewards.length)];
|
const fallback = rewards[Math.floor(Math.random() * rewards.length)];
|
||||||
|
|
||||||
this.wonReward = fallback;
|
this.wonReward = fallback;
|
||||||
this.generateCasePrizes(fallback);
|
this.generateCasePrizes(fallback);
|
||||||
this.isOpening = false;
|
this.isOpening = false;
|
||||||
|
@ -142,11 +142,11 @@ export default class LootboxOpeningComponent {
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.animationCompleted = true;
|
this.animationCompleted = true;
|
||||||
|
|
||||||
if (this.wonReward) {
|
if (this.wonReward) {
|
||||||
this.userService.updateLocalBalance(this.wonReward.value);
|
this.userService.updateLocalBalance(this.wonReward.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.userService.refreshCurrentUser();
|
this.userService.refreshCurrentUser();
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
[disabled]="!hasEnoughBalance(lootbox.price)"
|
[disabled]="!hasEnoughBalance(lootbox.price)"
|
||||||
[ngClass]="{
|
[ngClass]="{
|
||||||
'button-primary': hasEnoughBalance(lootbox.price),
|
'button-primary': hasEnoughBalance(lootbox.price),
|
||||||
'bg-gray-500 cursor-not-allowed': !hasEnoughBalance(lootbox.price)
|
'bg-gray-500 cursor-not-allowed': !hasEnoughBalance(lootbox.price),
|
||||||
}"
|
}"
|
||||||
class="w-full py-2 rounded font-semibold"
|
class="w-full py-2 rounded font-semibold"
|
||||||
>
|
>
|
||||||
|
|
|
@ -95,7 +95,7 @@ export default class LootboxSelectionComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.loadLootboxes();
|
this.loadLootboxes();
|
||||||
this.userService.currentUser$.subscribe(user => {
|
this.userService.currentUser$.subscribe((user) => {
|
||||||
this.currentUser = user;
|
this.currentUser = user;
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
});
|
});
|
||||||
|
@ -128,12 +128,12 @@ export default class LootboxSelectionComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
openLootbox(lootboxId: number): void {
|
openLootbox(lootboxId: number): void {
|
||||||
const lootbox = this.lootboxes.find(box => box.id === lootboxId);
|
const lootbox = this.lootboxes.find((box) => box.id === lootboxId);
|
||||||
|
|
||||||
if (!lootbox) {
|
if (!lootbox) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.currentUser || this.currentUser.balance < lootbox.price) {
|
if (!this.currentUser || this.currentUser.balance < lootbox.price) {
|
||||||
this.error = 'Nicht genug Guthaben, um diese Lootbox zu öffnen.';
|
this.error = 'Nicht genug Guthaben, um diese Lootbox zu öffnen.';
|
||||||
// Scroll to top to see the error message
|
// Scroll to top to see the error message
|
||||||
|
@ -145,7 +145,7 @@ export default class LootboxSelectionComponent implements OnInit {
|
||||||
}, 5000);
|
}, 5000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.router.navigate(['/game/lootboxes/open', lootboxId]);
|
this.router.navigate(['/game/lootboxes/open', lootboxId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,9 @@ export class UserService {
|
||||||
public updateLocalBalance(amount: number): void {
|
public updateLocalBalance(amount: number): void {
|
||||||
const currentUser = this.currentUserSubject.getValue();
|
const currentUser = this.currentUserSubject.getValue();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
const updatedUser = {
|
const updatedUser = {
|
||||||
...currentUser,
|
...currentUser,
|
||||||
balance: currentUser.balance + amount
|
balance: currentUser.balance + amount,
|
||||||
};
|
};
|
||||||
this.currentUserSubject.next(updatedUser);
|
this.currentUserSubject.next(updatedUser);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
|
||||||
this.balance.set(user?.balance ?? 0);
|
this.balance.set(user?.balance ?? 0);
|
||||||
console.log('Updated navbar balance:', user?.balance);
|
console.log('Updated navbar balance:', user?.balance);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.userService.refreshCurrentUser();
|
this.userService.refreshCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue