import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { NavbarComponent } from '../../shared/components/navbar/navbar.component'; import { CurrencyPipe, NgFor } from '@angular/common'; import { Game } from '../../model/Game'; import { Transaction } from '../../model/Transaction'; import { DepositComponent } from '../deposit/deposit.component'; import { ConfirmationComponent } from '../../shared/components/confirmation/confirmation.component'; import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-homepage', standalone: true, imports: [NavbarComponent, CurrencyPipe, NgFor, DepositComponent, ConfirmationComponent], templateUrl: './home.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export default class HomeComponent implements OnInit { isDepositModalOpen = false; isDepositSuccessful = false; constructor(public route: ActivatedRoute) {} ngOnInit() { this.isDepositSuccessful = this.route.snapshot.queryParams['success'] == 'true'; if (this.isDepositSuccessful) { this.openDepositConfirmationModal(); } } 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[] = []; openDepositModal() { this.isDepositModalOpen = true; } closeDepositModal() { this.isDepositModalOpen = false; } openDepositConfirmationModal() { this.isDepositSuccessful = true; } closeDepositConfirmationModal() { this.isDepositSuccessful = false; } }