feat(home): display user balance on home page
This commit is contained in:
parent
6bd2928166
commit
a9ed3c4a9a
2 changed files with 19 additions and 4 deletions
|
@ -59,6 +59,12 @@
|
||||||
<div class="lg:col-span-1 space-y-6">
|
<div class="lg:col-span-1 space-y-6">
|
||||||
<div class="card p-4">
|
<div class="card p-4">
|
||||||
<h3 class="section-heading text-xl mb-4">Konto</h3>
|
<h3 class="section-heading text-xl mb-4">Konto</h3>
|
||||||
|
<div *ngIf="user" class="mb-4 p-3 bg-deep-blue-light rounded">
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<span class="text-sm text-text-secondary">Kontostand</span>
|
||||||
|
<span class="text-xl font-bold text-emerald">{{ user.balance | currency: 'EUR' }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<button class="button-base w-full py-2" (click)="openDepositModal()">Einzahlen</button>
|
<button class="button-base w-full py-2" (click)="openDepositModal()">Einzahlen</button>
|
||||||
<app-deposit [isOpen]="isDepositModalOpen" (close)="closeDepositModal()"></app-deposit>
|
<app-deposit [isOpen]="isDepositModalOpen" (close)="closeDepositModal()"></app-deposit>
|
||||||
|
|
|
@ -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 { 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 { Game } from '../../model/Game';
|
||||||
import { Transaction } from '../../model/Transaction';
|
import { Transaction } from '../../model/Transaction';
|
||||||
import { DepositComponent } from '../deposit/deposit.component';
|
import { DepositComponent } from '../deposit/deposit.component';
|
||||||
|
import { User } from '../../model/User';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-homepage',
|
selector: 'app-homepage',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [NavbarComponent, CurrencyPipe, NgFor, DepositComponent],
|
imports: [NavbarComponent, CurrencyPipe, NgFor, NgIf, DepositComponent],
|
||||||
templateUrl: './home.component.html',
|
templateUrl: './home.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export default class HomeComponent {
|
export default class HomeComponent implements OnInit {
|
||||||
isDepositModalOpen = false;
|
isDepositModalOpen = false;
|
||||||
|
user: User | null = null;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
const userJson = sessionStorage.getItem('user');
|
||||||
|
if (userJson) {
|
||||||
|
this.user = JSON.parse(userJson);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
featuredGames: Game[] = [
|
featuredGames: Game[] = [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue