feat: added web view 1v1

This commit is contained in:
shahdlala66
2026-04-17 23:20:16 +02:00
commit 1828fa3275
80 changed files with 11876 additions and 0 deletions
@@ -0,0 +1,43 @@
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { finalize } from 'rxjs';
import { GameApiService } from '../../services/game-api.service';
@Component({
selector: 'app-welcome',
standalone: true,
imports: [CommonModule],
templateUrl: './welcome.component.html',
styleUrl: './welcome.component.css'
})
export class WelcomeComponent {
creating = false;
errorMessage = '';
constructor(
private readonly router: Router,
private readonly gameApi: GameApiService
) {}
startOneVsOne(): void {
if (this.creating) {
return;
}
this.errorMessage = '';
this.creating = true;
this.gameApi
.createGame()
.pipe(finalize(() => (this.creating = false)))
.subscribe({
next: (game) => {
void this.router.navigate(['/game', game.gameId]);
},
error: (error: { error?: { message?: string } }) => {
this.errorMessage = error.error?.message ?? 'Unable to create a game.';
}
});
}
}