feat(home): display user balance on home page

This commit is contained in:
Jan K9f 2025-02-27 15:42:16 +01:00
parent 6bd2928166
commit a9ed3c4a9a
2 changed files with 19 additions and 4 deletions

View file

@ -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[] = [
{