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,7 @@
.piece {
width: 90%;
height: 90%;
display: block;
object-fit: contain;
pointer-events: none;
}
@@ -0,0 +1,3 @@
@if (pieceCode) {
<img class="piece" [src]="spriteUrl" [alt]="pieceCode" />
}
@@ -0,0 +1,40 @@
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-chess-piece',
standalone: true,
templateUrl: './chess-piece.component.html',
styleUrl: './chess-piece.component.css'
})
export class ChessPieceComponent {
@Input({ required: true }) pieceCode: string | null = null;
get spriteUrl(): string {
if (!this.pieceCode) {
return '';
}
const color = this.pieceCode === this.pieceCode.toUpperCase() ? 'white' : 'black';
const pieceName = this.getPieceName(this.pieceCode.toLowerCase());
return `/arabian-chess/sprites/pieces/${color}_${pieceName}.png`;
}
private getPieceName(piece: string): string {
switch (piece) {
case 'k':
return 'king';
case 'q':
return 'queen';
case 'r':
return 'rook';
case 'b':
return 'bishop';
case 'n':
return 'knight';
case 'p':
return 'pawn';
default:
return 'pawn';
}
}
}