style: run prettier
This commit is contained in:
parent
bc56b498ee
commit
efc2a8ecec
5 changed files with 49 additions and 44 deletions
|
@ -31,8 +31,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div [ngClass]="slotResult().status === 'win' ? 'text-green-500' : 'text-red-500'">
|
<div [ngClass]="slotResult().status === 'win' ? 'text-green-500' : 'text-red-500'">
|
||||||
<p>Game result: <strong>{{ slotResult().status | uppercase }}</strong></p>
|
<p>
|
||||||
<p>Amount: <strong>{{ slotResult().amount }}</strong></p>
|
Game result: <strong>{{ slotResult().status | uppercase }}</strong>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Amount: <strong>{{ slotResult().amount }}</strong>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import {ChangeDetectionStrategy, Component, inject, OnInit, signal} from "@angular/core";
|
import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@angular/core';
|
||||||
import {NavbarComponent} from "@shared/components/navbar/navbar.component";
|
import { NavbarComponent } from '@shared/components/navbar/navbar.component';
|
||||||
import {HttpClient} from "@angular/common/http";
|
import { HttpClient } from '@angular/common/http';
|
||||||
import {KeyValuePipe, NgClass, UpperCasePipe} from "@angular/common";
|
import { KeyValuePipe, NgClass, UpperCasePipe } from '@angular/common';
|
||||||
import {FormsModule} from "@angular/forms";
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
interface SlotResult {
|
interface SlotResult {
|
||||||
status: 'win' | 'lose';
|
status: 'win' | 'lose';
|
||||||
|
@ -13,13 +13,7 @@ interface SlotResult {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-slots',
|
selector: 'app-slots',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [NavbarComponent, KeyValuePipe, UpperCasePipe, NgClass, FormsModule],
|
||||||
NavbarComponent,
|
|
||||||
KeyValuePipe,
|
|
||||||
UpperCasePipe,
|
|
||||||
NgClass,
|
|
||||||
FormsModule
|
|
||||||
],
|
|
||||||
templateUrl: './slots.component.html',
|
templateUrl: './slots.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
|
@ -30,25 +24,25 @@ export default class SlotsComponent implements OnInit {
|
||||||
status: 'lose',
|
status: 'lose',
|
||||||
amount: 12,
|
amount: 12,
|
||||||
resultMatrix: [
|
resultMatrix: [
|
||||||
["BAR", "BAR", "BAR"],
|
['BAR', 'BAR', 'BAR'],
|
||||||
["SEVEN", "SEVEN", "SEVEN"],
|
['SEVEN', 'SEVEN', 'SEVEN'],
|
||||||
["BELL", "BELL", "BELL"]
|
['BELL', 'BELL', 'BELL'],
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
betAmount = signal<number>(1);
|
betAmount = signal<number>(1);
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.httpClient.get<Record<string, number>>('/backend/slots/info').subscribe(data => {
|
this.httpClient.get<Record<string, number>>('/backend/slots/info').subscribe((data) => {
|
||||||
this.slotInfo.set(data);
|
this.slotInfo.set(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
spin(): void {
|
spin(): void {
|
||||||
const payload = {
|
const payload = {
|
||||||
betAmount: this.betAmount()
|
betAmount: this.betAmount(),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.httpClient.post<SlotResult>('/backend/slots/spin', payload).subscribe(result => {
|
this.httpClient.post<SlotResult>('/backend/slots/spin', payload).subscribe((result) => {
|
||||||
this.slotResult.set(result);
|
this.slotResult.set(result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
import {ChangeDetectionStrategy, Component, EventEmitter, inject, Input, Output,} from '@angular/core';
|
import {
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
EventEmitter,
|
||||||
|
inject,
|
||||||
|
Input,
|
||||||
|
Output,
|
||||||
|
} from '@angular/core';
|
||||||
import { TransactionService } from '@service/transaction.service';
|
import { TransactionService } from '@service/transaction.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { AsyncPipe, CurrencyPipe, DatePipe, NgIf } from '@angular/common';
|
import { AsyncPipe, CurrencyPipe, DatePipe, NgIf } from '@angular/common';
|
||||||
|
|
Reference in a new issue