From 212bee3bd29c895c881429dfbd173d8586498e0b Mon Sep 17 00:00:00 2001 From: Lea Date: Wed, 5 Mar 2025 11:48:42 +0100 Subject: [PATCH] feat: implemented confirmation modal for depositing money --- .../src/app/feature/home/home.component.html | 2 +- .../src/app/feature/home/home.component.ts | 41 ++++++++----------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/frontend/src/app/feature/home/home.component.html b/frontend/src/app/feature/home/home.component.html index ace0c10..e8b3430 100644 --- a/frontend/src/app/feature/home/home.component.html +++ b/frontend/src/app/feature/home/home.component.html @@ -71,7 +71,7 @@ - +

Letzte Transaktionen

diff --git a/frontend/src/app/feature/home/home.component.ts b/frontend/src/app/feature/home/home.component.ts index c9761da..f1e2f17 100644 --- a/frontend/src/app/feature/home/home.component.ts +++ b/frontend/src/app/feature/home/home.component.ts @@ -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; } }