feat: implemented confirmation modal for depositing money

This commit is contained in:
Lea 2025-03-05 11:48:42 +01:00
parent f172e00d0a
commit 212bee3bd2
2 changed files with 17 additions and 26 deletions

View file

@ -1,10 +1,11 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
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',
@ -13,9 +14,18 @@ import {ConfirmationComponent} from "../../shared/components/confirmation/confir
templateUrl: './home.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export default class HomeComponent {
export default class HomeComponent implements OnInit {
isDepositModalOpen = false;
isDepositSuccessful = true;
isDepositSuccessful = false;
constructor(public route: ActivatedRoute) {}
ngOnInit() {
this.isDepositSuccessful = this.route.snapshot.queryParams['success'] == 'true';
if (this.isDepositSuccessful) {
this.openDepositConfirmationModal();
}
}
featuredGames: Game[] = [
{
@ -52,26 +62,7 @@ export default class HomeComponent {
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',
},
];
recentTransactions: Transaction[] = [];
openDepositModal() {
this.isDepositModalOpen = true;
@ -80,10 +71,10 @@ export default class HomeComponent {
this.isDepositModalOpen = false;
}
openDepositSuccessfulModal() {
openDepositConfirmationModal() {
this.isDepositSuccessful = true;
}
closeDepositSuccessfulModal() {
closeDepositConfirmationModal() {
this.isDepositSuccessful = false;
}
}