style: bootstrap added

This commit is contained in:
shahdlala66
2026-04-18 23:21:25 +02:00
parent 8b090e4d96
commit 0d7bb0343c
7 changed files with 370 additions and 129 deletions
+31
View File
@@ -14,6 +14,7 @@
"@angular/forms": "^20.3.0",
"@angular/platform-browser": "^20.3.0",
"@angular/router": "^20.3.0",
"bootstrap": "^5.3.8",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
@@ -2969,6 +2970,17 @@
"license": "MIT",
"optional": true
},
"node_modules/@popperjs/core": {
"version": "2.11.8",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
"license": "MIT",
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.59.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz",
@@ -3820,6 +3832,25 @@
"dev": true,
"license": "ISC"
},
"node_modules/bootstrap": {
"version": "5.3.8",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.8.tgz",
"integrity": "sha512-HP1SZDqaLDPwsNiqRqi5NcP0SSXciX2s9E+RyqJIIqGo+vJeN5AJVM98CXmW/Wux0nQ5L7jeWUdplCEf0Ee+tg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/twbs"
},
{
"type": "opencollective",
"url": "https://opencollective.com/bootstrap"
}
],
"license": "MIT",
"peerDependencies": {
"@popperjs/core": "^2.11.8"
}
},
"node_modules/brace-expansion": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
+1
View File
@@ -28,6 +28,7 @@
"@angular/forms": "^20.3.0",
"@angular/platform-browser": "^20.3.0",
"@angular/router": "^20.3.0",
"bootstrap": "^5.3.8",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
@@ -1,7 +1,31 @@
.piece {
width: clamp(40px, 9cqh, 130px);
height: clamp(40px, 9cqh, 130px);
width: clamp(50px, 11cqh, 160px);
height: clamp(50px, 11cqh, 160px);
display: block;
object-fit: contain;
pointer-events: none;
}
/* Tablets and below - reduce piece size */
@media (max-width: 991px) {
.piece {
width: clamp(40px, 9cqh, 130px);
height: clamp(40px, 9cqh, 130px);
}
}
/* Mobile - smaller pieces */
@media (max-width: 768px) {
.piece {
width: clamp(32px, 8cqh, 100px);
height: clamp(32px, 8cqh, 100px);
}
}
/* Small phones - even smaller */
@media (max-width: 480px) {
.piece {
width: clamp(24px, 6cqh, 75px);
height: clamp(24px, 6cqh, 75px);
}
}
+191 -99
View File
@@ -1,21 +1,158 @@
.game-shell {
height: 100dvh;
min-height: 100dvh;
padding: clamp(0.75rem, 2vw, 1.5rem);
overflow: hidden;
}
.game-card {
max-width: 1100px;
height: 100%;
max-width: 1400px;
margin: 0 auto;
background: #F3C8A0;
border: 2px solid #5A2C28;
border-radius: 12px;
padding: clamp(0.75rem, 1.5vw, 1.25rem);
padding: clamp(1rem, 2vw, 1.5rem);
box-shadow: 0 8px 24px rgba(90, 44, 40, 0.2);
}
header {
margin-bottom: 1.5rem;
}
h1,
h2 {
color: #5A2C28;
margin: 0 0 0.5rem;
font-size: clamp(1.5rem, 4vw, 2rem);
}
.meta {
color: #5A2C28;
font-size: 0.95rem;
}
.back-link {
display: inline-block;
margin-bottom: 0.5rem;
color: #5A2C28;
text-decoration: none;
font-weight: 600;
}
.back-link:hover {
text-decoration: underline;
}
.top-section {
background: #F3C8A0;
padding: 0.75rem;
border-radius: 8px;
border: 1px solid #5A2C28;
}
.move-form {
align-items: center;
}
.move-form label {
color: #5A2C28;
font-weight: 600;
white-space: nowrap;
}
.board-hint {
color: #5A2C28;
margin: 0;
}
.center-column {
width: 100%;
}
.board-section {
background: #B9DAD1;
border: 2px solid #5A2C28;
border-radius: 10px;
padding: clamp(0.5rem, 1vw, 1rem);
min-height: 400px;
container-type: size;
}
.import-card {
background: #E1EAA9;
border: 2px solid #5A2C28;
border-radius: 10px;
padding: 1rem;
display: flex;
flex-direction: column;
min-height: 0;
gap: 0.75rem;
}
.import-card label {
color: #5A2C28;
font-weight: 700;
margin-bottom: 0.25rem;
}
.import-card textarea {
border: 2px solid #5A2C28;
border-radius: 8px;
background: #B9DAD1;
padding: 0.6rem 0.75rem;
resize: vertical;
min-height: 100px;
font-family: inherit;
}
.import-card input {
border: 2px solid #5A2C28;
border-radius: 8px;
background: #B9DAD1;
padding: 0.6rem 0.75rem;
font-family: inherit;
}
.btn {
border: 2px solid #5A2C28;
border-radius: 8px;
background: #C19EF5;
color: #5A2C28;
padding: 0.6rem 1rem;
cursor: pointer;
font-weight: 600;
transition: background-color 0.2s, color 0.2s;
}
.btn:hover {
background: #BA6D4B;
color: #F3C8A0;
}
.alert {
border-radius: 8px;
border: 2px solid #5A2C28;
}
@media (max-width: 991px) {
.game-card {
padding: clamp(0.75rem, 1.5vw, 1rem);
}
.board-section {
min-height: 350px;
}
h1,
h2 {
font-size: clamp(1.25rem, 3vw, 1.75rem);
}
}
@media (max-width: 768px) {
.game-shell {
padding: clamp(0.5rem, 1.5vw, 1rem);
}
.game-card {
padding: clamp(0.5rem, 1vw, 0.75rem);
}
header {
@@ -24,138 +161,93 @@ header {
h1,
h2 {
color: #5A2C28;
margin: 0 0 0.5rem;
font-size: 1.25rem;
}
.meta {
margin: 0;
}
.back-link {
display: inline-block;
margin-bottom: 0.5rem;
color: #5A2C28;
font-size: 0.85rem;
}
.top-section {
display: grid;
gap: 0.5rem;
margin-bottom: 0.5rem;
flex: 0 0 auto;
}
.content-layout {
flex: 1 1 auto;
min-height: 0;
display: grid;
grid-template-columns: minmax(220px, 0.95fr) minmax(0, 2.4fr) minmax(220px, 0.95fr);
gap: 0.75rem;
}
.center-column {
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
padding: 0.5rem;
margin-bottom: 0.75rem;
}
.move-form {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem;
}
.board-hint {
margin: 0;
color: #5A2C28;
.move-form label {
flex-basis: 100%;
margin-bottom: 0.5rem;
}
.board-section {
flex: 1 1 auto;
min-height: 180px;
display: grid;
place-items: center;
container-type: size;
padding: clamp(0.35rem, 1vw, 0.75rem);
border-radius: 10px;
border: 2px solid #5A2C28;
background: #B9DAD1;
overflow: hidden;
min-height: 300px;
}
.import-card {
background: #E1EAA9;
border: 2px solid #5A2C28;
border-radius: 10px;
padding: 0.65rem;
display: grid;
align-self: start;
align-content: start;
padding: 0.75rem;
gap: 0.5rem;
}
.import-card label {
color: #5A2C28;
font-weight: 700;
font-size: 0.9rem;
}
input {
border: 2px solid #5A2C28;
border-radius: 10px;
background: #B9DAD1;
padding: 0.6rem 0.75rem;
min-width: 180px;
.import-card textarea,
.import-card input {
min-height: 70px;
font-size: 0.9rem;
padding: 0.5rem;
}
textarea {
border: 2px solid #5A2C28;
border-radius: 10px;
background: #B9DAD1;
padding: 0.6rem 0.75rem;
resize: vertical;
min-height: 80px;
.btn {
padding: 0.5rem 0.75rem;
font-size: 0.9rem;
}
}
button {
border: 2px solid #5A2C28;
border-radius: 10px;
background: #C19EF5;
color: #5A2C28;
padding: 0.6rem 1rem;
cursor: pointer;
@media (max-width: 480px) {
.game-shell {
padding: 0.5rem;
}
button:hover {
background: #BA6D4B;
color: #F3C8A0;
.game-card {
padding: 0.5rem;
border-radius: 8px;
}
.error {
margin-top: 0.5rem;
color: #5A2C28;
font-weight: 700;
header {
margin-bottom: 0.75rem;
}
@media (max-width: 920px) {
.content-layout {
grid-template-columns: 1fr;
grid-template-areas:
"center"
"fen"
"pgn";
h1 {
font-size: 1.1rem;
}
.center-column {
grid-area: center;
.meta {
font-size: 0.75rem;
}
.fen-card {
grid-area: fen;
.top-section {
padding: 0.4rem;
margin-bottom: 0.5rem;
}
.pgn-card {
grid-area: pgn;
.board-section {
min-height: 250px;
}
.import-card {
padding: 0.5rem;
gap: 0.35rem;
}
.import-card textarea,
.import-card input {
min-height: 50px;
font-size: 0.8rem;
padding: 0.4rem;
}
}
+37 -20
View File
@@ -1,16 +1,19 @@
<main class="game-shell">
<section class="game-card">
<header>
<header class="mb-3">
<a routerLink="/" class="back-link">Back</a>
<h1>1 vs 1 Game</h1>
<p class="meta">Game ID: <strong>{{ facade.gameId }}</strong></p>
<h1 class="mb-2">1 vs 1 Game</h1>
<p class="meta mb-0">Game ID: <strong>{{ facade.gameId }}</strong></p>
</header>
@if (facade.loading) {
<p>Loading game state...</p>
} @else if (facade.state) {
<section class="content-layout">
<aside class="import-card fen-card">
<div class="container-fluid">
<div class="row g-3">
<!-- Left Sidebar - FEN Import -->
<div class="col-lg-3 col-md-6 col-12 order-lg-1 order-2">
<aside class="import-card fen-card h-100">
<label for="fenImport">Import FEN</label>
<textarea
id="fenImport"
@@ -19,30 +22,42 @@
rows="4"
placeholder="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
></textarea>
<button type="button" (click)="facade.importFen()">Load FEN</button>
<button type="button" class="btn w-100" (click)="facade.importFen()">Load FEN</button>
</aside>
</div>
<section class="center-column">
<section class="top-section">
<form class="move-form" (ngSubmit)="facade.submitMove()">
<label for="uciMove">Play move (UCI)</label>
<input id="uciMove" name="uciMove" [(ngModel)]="facade.moveInput" placeholder="e2e4" />
<button type="submit">Send Move</button>
<!-- Center - Chess Board -->
<div class="col-lg-6 col-md-12 col-12 order-lg-2 order-1">
<section class="center-column d-flex flex-column h-100">
<div class="top-section mb-3">
<form class="move-form d-flex flex-wrap gap-2 mb-2" (ngSubmit)="facade.submitMove()">
<label for="uciMove" class="form-label mb-0">Play move (UCI)</label>
<input
id="uciMove"
name="uciMove"
class="form-control flex-grow-1"
[(ngModel)]="facade.moveInput"
placeholder="e2e4"
/>
<button type="submit" class="btn">Send Move</button>
</form>
<p class="board-hint">Click your piece to highlight legal targets.</p>
</section>
<p class="board-hint small mb-0">Click your piece to highlight legal targets.</p>
</div>
<section class="board-section">
<div class="board-section flex-grow-1 d-flex align-items-center justify-content-center">
<app-chess-board
[fen]="facade.state.fen"
[selectedSquare]="facade.selectedSquare"
[highlightedSquares]="facade.highlightedSquares"
(squareSelected)="facade.onBoardSquareSelected($event)"
/>
</div>
</section>
</section>
</div>
<aside class="import-card pgn-card">
<!-- Right Sidebar - PGN Import -->
<div class="col-lg-3 col-md-6 col-12 order-lg-3 order-3">
<aside class="import-card pgn-card h-100">
<label for="pgnImport">Import PGN</label>
<textarea
id="pgnImport"
@@ -51,13 +66,15 @@
rows="4"
placeholder="1. e4 e5 2. Nf3 Nc6 *"
></textarea>
<button type="button" (click)="facade.importPgn()">Load PGN</button>
<button type="button" class="btn w-100" (click)="facade.importPgn()">Load PGN</button>
</aside>
</section>
</div>
</div>
</div>
}
@if (facade.errorMessage) {
<p class="error">{{ facade.errorMessage }}</p>
<p class="alert alert-danger mt-3 mb-0">{{ facade.errorMessage }}</p>
}
</section>
</main>
@@ -67,3 +67,77 @@ p {
font-weight: 700;
margin-top: 1rem;
}
@media (max-width: 768px) {
.welcome-shell {
padding: 1rem;
}
.welcome-card {
padding: 1.5rem;
}
h1 {
font-size: 1.5rem;
}
p {
font-size: 0.875rem;
margin: 0 0 1rem;
}
.mode-grid {
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 0.75rem;
}
.mode {
padding: 0.75rem;
gap: 0.15rem;
}
.mode span {
font-size: 1rem;
}
.mode small {
font-size: 0.7rem;
}
.error {
font-size: 0.75rem;
}
}
@media (max-width: 480px) {
.welcome-shell {
padding: 0.5rem;
}
.welcome-card {
padding: 1rem;
border-radius: 8px;
}
h1 {
font-size: 1.25rem;
margin: 0 0 0.15rem;
}
p {
font-size: 0.8rem;
margin: 0 0 0.75rem;
}
.mode-grid {
grid-template-columns: 1fr;
}
.mode {
padding: 0.65rem;
}
.mode span {
font-size: 0.95rem;
}
}
+2
View File
@@ -1,3 +1,5 @@
@import 'bootstrap/dist/css/bootstrap.min.css';
:root {
--warm-primary: #BA6D4B;
--warm-dark: #5A2C28;