diff --git a/frontend/src/app/feature/home/home.component.html b/frontend/src/app/feature/home/home.component.html index cc1ed16..3b3232d 100644 --- a/frontend/src/app/feature/home/home.component.html +++ b/frontend/src/app/feature/home/home.component.html @@ -59,6 +59,12 @@

Konto

+
+
+ Kontostand + {{ user.balance | currency: 'EUR' }} +
+
diff --git a/frontend/src/app/feature/home/home.component.ts b/frontend/src/app/feature/home/home.component.ts index 6400d5a..6fcae2f 100644 --- a/frontend/src/app/feature/home/home.component.ts +++ b/frontend/src/app/feature/home/home.component.ts @@ -1,19 +1,28 @@ -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 { 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, DepositComponent], + imports: [NavbarComponent, CurrencyPipe, NgFor, NgIf, DepositComponent], templateUrl: './home.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) -export default class HomeComponent { +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[] = [ {