comfirmation modal for deposit and refactoring

This commit is contained in:
Lea 2025-03-05 10:20:31 +01:00
parent 63db07b6ae
commit caf2794489
8 changed files with 74 additions and 32 deletions

View file

@ -1,13 +1,11 @@
<ng-container *ngIf="isOpen"> @if (isOpen){
<div class="fixed inset-0 bg-black/70 z-50 focus:outline-none focus:ring-2 focus:purple"> <div class="modal-bg">
<div <div class="modal-card">
class="card p-4 fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg shadow-lg z-50 min-w-[300px]" <h2 class="modal-heading">Guthaben aufladen</h2>
>
<h2 class="text-xl section-heading">Guthaben aufladen</h2>
<form [formGroup]="form"> <form [formGroup]="form">
<div *ngIf="errorMsg"> @if (errorMsg){
{{ errorMsg }} {{ errorMsg }}
</div> }
<div class="mb-2"> <div class="mb-2">
<label for="amount">Betrag</label> <label for="amount">Betrag</label>
<input <input
@ -19,14 +17,9 @@
</div> </div>
</form> </form>
<div class="my-1"> <div class="my-1">
<button <button (click)="closeModal()" class="button-secondary">Abbrechen</button>
(click)="closeModal()" <button (click)="submit()" class="button-primary w-full py-2">Einzahlen</button>
class="bg-deep-blue-light hover:bg-deep-blue-contrast w-full py-2 rounded my-2"
>
Abbrechen
</button>
<button (click)="submit()" class="button-base w-full py-2">Einzahlen</button>
</div> </div>
</div> </div>
</div> </div>
</ng-container> }

View file

@ -28,7 +28,7 @@
> >
<div class="absolute bottom-4 left-4 right-4"> <div class="absolute bottom-4 left-4 right-4">
<h4 class="game-heading">{{ game.name }}</h4> <h4 class="game-heading">{{ game.name }}</h4>
<button class="button-base w-full py-2">Jetzt Spielen</button> <button class="button-primary w-full py-2">Jetzt Spielen</button>
</div> </div>
</div> </div>
</div> </div>
@ -47,7 +47,7 @@
> >
<div class="absolute bottom-4 left-4 right-4"> <div class="absolute bottom-4 left-4 right-4">
<h4 class="game-heading">{{ game.name }}</h4> <h4 class="game-heading">{{ game.name }}</h4>
<button class="button-base w-full py-2">Jetzt Spielen</button> <button class="button-primary w-full py-2">Jetzt Spielen</button>
</div> </div>
</div> </div>
</div> </div>
@ -60,7 +60,7 @@
<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 class="space-y-4"> <div class="space-y-4">
<button class="button-base w-full py-2" (click)="openDepositModal()">Einzahlen</button> <button class="button-primary w-full py-2" (click)="openDepositModal()">Einzahlen</button>
<app-deposit [isOpen]="isDepositModalOpen" (close)="closeDepositModal()"></app-deposit> <app-deposit [isOpen]="isDepositModalOpen" (close)="closeDepositModal()"></app-deposit>
<button class="bg-deep-blue-light hover:bg-deep-blue-contrast w-full py-2 rounded"> <button class="bg-deep-blue-light hover:bg-deep-blue-contrast w-full py-2 rounded">
Transaktionen Transaktionen
@ -71,6 +71,8 @@
</div> </div>
</div> </div>
<app-confirmation></app-confirmation>
<div class="card p-4"> <div class="card p-4">
<h3 class="section-heading text-xl mb-4">Letzte Transaktionen</h3> <h3 class="section-heading text-xl mb-4">Letzte Transaktionen</h3>
<div class="space-y-3"> <div class="space-y-3">

View file

@ -4,11 +4,12 @@ import { CurrencyPipe, NgFor } 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 {ConfirmationComponent} from "../../shared/components/confirmation/confirmation.component";
@Component({ @Component({
selector: 'app-homepage', selector: 'app-homepage',
standalone: true, standalone: true,
imports: [NavbarComponent, CurrencyPipe, NgFor, DepositComponent], imports: [NavbarComponent, CurrencyPipe, NgFor, DepositComponent, ConfirmationComponent],
templateUrl: './home.component.html', templateUrl: './home.component.html',
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })

View file

@ -10,7 +10,7 @@
<div class="welcome-bonus">200% bis zu 500€</div> <div class="welcome-bonus">200% bis zu 500€</div>
<p class="bonus-description">+ 200 Freispiele</p> <p class="bonus-description">+ 200 Freispiele</p>
<button class="w-full sm:w-auto button-base px-6 sm:px-8 py-3 shadow-lg"> <button class="w-full sm:w-auto button-primary px-6 sm:px-8 py-3 shadow-lg">
Bonus Sichern Bonus Sichern
</button> </button>
</div> </div>
@ -28,21 +28,21 @@
<div class="game-card-content"> <div class="game-card-content">
<h3 class="game-heading-sm">Slots</h3> <h3 class="game-heading-sm">Slots</h3>
<p class="game-text">Klassische Spielautomaten</p> <p class="game-text">Klassische Spielautomaten</p>
<button class="button-base w-full py-2">Jetzt Spielen</button> <button class="button-primary w-full py-2">Jetzt Spielen</button>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="game-card-content"> <div class="game-card-content">
<h3 class="game-heading-sm">Plinko</h3> <h3 class="game-heading-sm">Plinko</h3>
<p class="game-text">Spannendes Geschicklichkeitsspiel</p> <p class="game-text">Spannendes Geschicklichkeitsspiel</p>
<button class="button-base w-full py-2">Jetzt Spielen</button> <button class="button-primary w-full py-2">Jetzt Spielen</button>
</div> </div>
</div> </div>
<div class="hidden lg:block card"> <div class="hidden lg:block card">
<div class="game-card-content"> <div class="game-card-content">
<h3 class="game-heading-sm">Blackjack</h3> <h3 class="game-heading-sm">Blackjack</h3>
<p class="game-text">Klassisches Kartenspiel</p> <p class="game-text">Klassisches Kartenspiel</p>
<button class="button-base w-full py-2">Jetzt Spielen</button> <button class="button-primary w-full py-2">Jetzt Spielen</button>
</div> </div>
</div> </div>
</div> </div>
@ -52,21 +52,21 @@
<div class="game-card-content"> <div class="game-card-content">
<h3 class="game-heading-sm">Poker</h3> <h3 class="game-heading-sm">Poker</h3>
<p class="game-text">Texas Hold'em & mehr</p> <p class="game-text">Texas Hold'em & mehr</p>
<button class="button-base w-full py-2">Jetzt Spielen</button> <button class="button-primary w-full py-2">Jetzt Spielen</button>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="game-card-content"> <div class="game-card-content">
<h3 class="game-heading-sm">Liars Dice</h3> <h3 class="game-heading-sm">Liars Dice</h3>
<p class="game-text">Würfelspiel mit Strategie</p> <p class="game-text">Würfelspiel mit Strategie</p>
<button class="button-base w-full py-2">Jetzt Spielen</button> <button class="button-primary w-full py-2">Jetzt Spielen</button>
</div> </div>
</div> </div>
<div class="hidden lg:block card"> <div class="hidden lg:block card">
<div class="game-card-content"> <div class="game-card-content">
<h3 class="game-heading-sm">Lootboxen</h3> <h3 class="game-heading-sm">Lootboxen</h3>
<p class="game-text">Überraschungskisten</p> <p class="game-text">Überraschungskisten</p>
<button class="button-base w-full py-2">Jetzt Spielen</button> <button class="button-primary w-full py-2">Jetzt Spielen</button>
</div> </div>
</div> </div>
</div> </div>

View file

@ -0,0 +1,14 @@
@if (successful) {
<div class="modal-bg">
<div class="modal-card">
<h2 class="modal-heading text-center">Bestätigung</h2>
<p class="py-2">Der Vorgang wurde erfolgreich abgeschlossen.</p>
<button
type="button"
class="button-primary w-full py-2 my-auto"
(click)="closeModal()"
>Schließen</button>
</div>
</div>
}

View file

@ -0,0 +1,16 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
@Component({
selector: 'app-confirmation',
standalone: true,
imports: [],
templateUrl: './confirmation.component.html',
})
export class ConfirmationComponent {
@Input() successful: boolean = true;
@Output() close = new EventEmitter<void>();
public closeModal(){
this.close.emit();
}
}

View file

@ -12,10 +12,10 @@
<div class="hidden md:flex items-center space-x-4"> <div class="hidden md:flex items-center space-x-4">
@if (!isLoggedIn) { @if (!isLoggedIn) {
<button (click)="login()" class="button-base px-4 py-1.5">Anmelden</button> <button (click)="login()" class="button-primary px-4 py-1.5">Anmelden</button>
} }
@if (isLoggedIn) { @if (isLoggedIn) {
<button (click)="logout()" class="button-base px-4 py-1.5">Abmelden</button> <button (click)="logout()" class="button-primary px-4 py-1.5">Abmelden</button>
} }
</div> </div>
@ -58,10 +58,10 @@
<a routerLink="/games" class="nav-mobile-link">Spiele</a> <a routerLink="/games" class="nav-mobile-link">Spiele</a>
<div class="pt-2 space-y-2"> <div class="pt-2 space-y-2">
@if (!isLoggedIn) { @if (!isLoggedIn) {
<button (click)="login()" class="button-base w-full py-1.5">Anmelden</button> <button (click)="login()" class="button-primary w-full py-1.5">Anmelden</button>
} }
@if (isLoggedIn) { @if (isLoggedIn) {
<button (click)="logout()" class="button-base w-full py-1.5">Abmelden</button> <button (click)="logout()" class="button-primary w-full py-1.5">Abmelden</button>
} }
</div> </div>
</div> </div>

View file

@ -31,10 +31,14 @@ a {
@apply bg-deep-blue-contrast rounded-lg overflow-hidden shadow-lg hover:shadow-xl transition-shadow duration-300; @apply bg-deep-blue-contrast rounded-lg overflow-hidden shadow-lg hover:shadow-xl transition-shadow duration-300;
} }
.button-base { .button-primary {
@apply bg-emerald hover:bg-emerald-dark text-text-primary transition-all duration-300 active:scale-95 rounded; @apply bg-emerald hover:bg-emerald-dark text-text-primary transition-all duration-300 active:scale-95 rounded;
} }
.button-secondary {
@apply bg-deep-blue-light hover:bg-deep-blue-contrast w-full py-2 rounded my-2;
}
.game-card-content { .game-card-content {
@apply p-4; @apply p-4;
} }
@ -138,3 +142,15 @@ a {
.footer-disclaimer { .footer-disclaimer {
@apply text-xs; @apply text-xs;
} }
.modal-bg {
@apply fixed inset-0 bg-black/70 z-50 focus:outline-none focus:ring-2 focus:ring-emerald-light;
}
.modal-card {
@apply bg-deep-blue-contrast overflow-hidden hover:shadow-xl transition-shadow duration-300 p-4 fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 p-6 rounded-lg shadow-lg z-50 min-w-[300px];
}
.modal-heading {
@apply text-xl font-bold text-text-primary;
}