feat: Create basic layout for coinflip
Some checks failed
CI / Get Changed Files (pull_request) Successful in 7s
CI / Checkstyle Main (pull_request) Has been skipped
CI / Docker backend validation (pull_request) Has been skipped
CI / oxlint (pull_request) Failing after 19s
CI / eslint (pull_request) Failing after 26s
CI / prettier (pull_request) Successful in 26s
CI / Docker frontend validation (pull_request) Successful in 44s
CI / test-build (pull_request) Successful in 45s
Some checks failed
CI / Get Changed Files (pull_request) Successful in 7s
CI / Checkstyle Main (pull_request) Has been skipped
CI / Docker backend validation (pull_request) Has been skipped
CI / oxlint (pull_request) Failing after 19s
CI / eslint (pull_request) Failing after 26s
CI / prettier (pull_request) Successful in 26s
CI / Docker frontend validation (pull_request) Successful in 44s
CI / test-build (pull_request) Successful in 45s
This commit is contained in:
parent
61b806c048
commit
41f3b506a0
3 changed files with 55 additions and 0 deletions
|
@ -38,6 +38,11 @@ export const routes: Routes = [
|
|||
loadComponent: () => import('./feature/game/blackjack/blackjack.component'),
|
||||
canActivate: [authGuard],
|
||||
},
|
||||
{
|
||||
path: 'game/coinflip',
|
||||
loadComponent: () => import('./feature/game/coinflip/coinflip.component'),
|
||||
canActivate: [authGuard],
|
||||
},
|
||||
{
|
||||
path: 'game/slots',
|
||||
loadComponent: () => import('./feature/game/slots/slots.component'),
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<p>Coinflip works!</p>
|
||||
|
||||
<div class="container mx-auto">
|
||||
<div class="grid grid-cols-4">
|
||||
<div class="col-span-3"></div>
|
||||
<div class="col-span-1">
|
||||
<app-game-info
|
||||
[balance]="balance()"
|
||||
[currentBet]="currentBet()"
|
||||
[gameInProgress]="gameInProgress()"
|
||||
[isActionInProgress]="isActionInProgress()"
|
||||
(newGame)="onNewGame($event)"
|
||||
></app-game-info>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
34
frontend/src/app/feature/game/coinflip/coinflip.component.ts
Normal file
34
frontend/src/app/feature/game/coinflip/coinflip.component.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@angular/core';
|
||||
import { GameInfoComponent } from '@blackjack/components/game-info/game-info.component';
|
||||
import { AuthService } from '@service/auth.service';
|
||||
import { AudioService } from '@shared/services/audio.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-coinflip',
|
||||
standalone: true,
|
||||
imports: [GameInfoComponent],
|
||||
templateUrl: './coinflip.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export default class CoinflipComponent implements OnInit {
|
||||
currentBet = signal(0);
|
||||
balance = signal(0);
|
||||
gameInProgress = signal(false);
|
||||
isActionInProgress = signal(false);
|
||||
audioService = inject(AudioService);
|
||||
authService = inject(AuthService);
|
||||
|
||||
onNewGame(bet: number): void {
|
||||
this.isActionInProgress.set(true);
|
||||
this.audioService.playBetSound();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// Subscribe to user updates for real-time balance changes
|
||||
this.authService.userSubject.subscribe((user) => {
|
||||
if (user) {
|
||||
this.balance.set(user.balance);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Reference in a new issue