89 lines
1.9 KiB
TypeScript
89 lines
1.9 KiB
TypeScript
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
|
import { NavbarComponent } from '../../shared/components/navbar/navbar.component';
|
|
import { CurrencyPipe, NgFor, NgIf } from '@angular/common';
|
|
import { Game } from '../../model/Game';
|
|
import { Transaction } from '../../model/Transaction';
|
|
import { DepositComponent } from '../deposit/deposit.component';
|
|
import { User } from '../../model/User';
|
|
|
|
@Component({
|
|
selector: 'app-homepage',
|
|
standalone: true,
|
|
imports: [NavbarComponent, CurrencyPipe, NgFor, NgIf, DepositComponent],
|
|
templateUrl: './home.component.html',
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
})
|
|
export default class HomeComponent implements OnInit {
|
|
isDepositModalOpen = false;
|
|
user: User | null = null;
|
|
|
|
ngOnInit(): void {
|
|
const userJson = sessionStorage.getItem('user');
|
|
if (userJson) {
|
|
this.user = JSON.parse(userJson);
|
|
}
|
|
}
|
|
|
|
featuredGames: Game[] = [
|
|
{
|
|
id: '1',
|
|
name: 'Poker',
|
|
image: '/poker.webp',
|
|
},
|
|
{
|
|
id: '2',
|
|
name: 'Blackjack',
|
|
image: '/blackjack.webp',
|
|
},
|
|
{
|
|
id: '3',
|
|
name: 'Slots',
|
|
image: '/slots.webp',
|
|
},
|
|
{
|
|
id: '4',
|
|
name: 'Plinko',
|
|
image: '/plinko.webp',
|
|
},
|
|
{
|
|
id: '5',
|
|
name: 'Liars Dice',
|
|
image: '/liars-dice.webp',
|
|
},
|
|
{
|
|
id: '6',
|
|
name: 'Lootboxen',
|
|
image: '/lootbox.webp',
|
|
},
|
|
];
|
|
|
|
allGames: Game[] = [...this.featuredGames];
|
|
|
|
recentTransactions: Transaction[] = [
|
|
{
|
|
id: '1',
|
|
type: 'Deposit',
|
|
amount: 100.0,
|
|
date: '2024-03-20',
|
|
},
|
|
{
|
|
id: '2',
|
|
type: 'Withdrawal',
|
|
amount: -50.0,
|
|
date: '2024-03-19',
|
|
},
|
|
{
|
|
id: '3',
|
|
type: 'Bonus',
|
|
amount: 25.0,
|
|
date: '2024-03-18',
|
|
},
|
|
];
|
|
|
|
openDepositModal() {
|
|
this.isDepositModalOpen = true;
|
|
}
|
|
closeDepositModal() {
|
|
this.isDepositModalOpen = false;
|
|
}
|
|
}
|