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/forms": "^20.3.0",
"@angular/platform-browser": "^20.3.0", "@angular/platform-browser": "^20.3.0",
"@angular/router": "^20.3.0", "@angular/router": "^20.3.0",
"bootstrap": "^5.3.8",
"rxjs": "~7.8.0", "rxjs": "~7.8.0",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"zone.js": "~0.15.0" "zone.js": "~0.15.0"
@@ -2969,6 +2970,17 @@
"license": "MIT", "license": "MIT",
"optional": true "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": { "node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.59.0", "version": "4.59.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz",
@@ -3820,6 +3832,25 @@
"dev": true, "dev": true,
"license": "ISC" "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": { "node_modules/brace-expansion": {
"version": "1.1.14", "version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
+2 -1
View File
@@ -28,6 +28,7 @@
"@angular/forms": "^20.3.0", "@angular/forms": "^20.3.0",
"@angular/platform-browser": "^20.3.0", "@angular/platform-browser": "^20.3.0",
"@angular/router": "^20.3.0", "@angular/router": "^20.3.0",
"bootstrap": "^5.3.8",
"rxjs": "~7.8.0", "rxjs": "~7.8.0",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"zone.js": "~0.15.0" "zone.js": "~0.15.0"
@@ -45,4 +46,4 @@
"karma-jasmine-html-reporter": "~2.1.0", "karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.9.2" "typescript": "~5.9.2"
} }
} }
@@ -1,7 +1,31 @@
.piece { .piece {
width: clamp(40px, 9cqh, 130px); width: clamp(50px, 11cqh, 160px);
height: clamp(40px, 9cqh, 130px); height: clamp(50px, 11cqh, 160px);
display: block; display: block;
object-fit: contain; object-fit: contain;
pointer-events: none; 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);
}
}
+172 -80
View File
@@ -1,161 +1,253 @@
.game-shell { .game-shell {
height: 100dvh; min-height: 100dvh;
padding: clamp(0.75rem, 2vw, 1.5rem); padding: clamp(0.75rem, 2vw, 1.5rem);
overflow: hidden;
} }
.game-card { .game-card {
max-width: 1100px; max-width: 1400px;
height: 100%;
margin: 0 auto; margin: 0 auto;
background: #F3C8A0; background: #F3C8A0;
border: 2px solid #5A2C28; border: 2px solid #5A2C28;
border-radius: 12px; 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); box-shadow: 0 8px 24px rgba(90, 44, 40, 0.2);
display: flex;
flex-direction: column;
min-height: 0;
} }
header { header {
margin-bottom: 1rem; margin-bottom: 1.5rem;
} }
h1, h1,
h2 { h2 {
color: #5A2C28; color: #5A2C28;
margin: 0 0 0.5rem; margin: 0 0 0.5rem;
font-size: clamp(1.5rem, 4vw, 2rem);
} }
.meta { .meta {
margin: 0; color: #5A2C28;
font-size: 0.95rem;
} }
.back-link { .back-link {
display: inline-block; display: inline-block;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
color: #5A2C28; color: #5A2C28;
text-decoration: none;
font-weight: 600;
}
.back-link:hover {
text-decoration: underline;
} }
.top-section { .top-section {
display: grid; background: #F3C8A0;
gap: 0.5rem; padding: 0.75rem;
margin-bottom: 0.5rem; border-radius: 8px;
flex: 0 0 auto; border: 1px solid #5A2C28;
}
.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;
} }
.move-form { .move-form {
display: flex;
flex-wrap: wrap;
align-items: center; align-items: center;
gap: 0.75rem; }
.move-form label {
color: #5A2C28;
font-weight: 600;
white-space: nowrap;
} }
.board-hint { .board-hint {
margin: 0;
color: #5A2C28; color: #5A2C28;
margin: 0;
}
.center-column {
width: 100%;
} }
.board-section { .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; background: #B9DAD1;
overflow: hidden; border: 2px solid #5A2C28;
border-radius: 10px;
padding: clamp(0.5rem, 1vw, 1rem);
min-height: 400px;
container-type: size;
} }
.import-card { .import-card {
background: #E1EAA9; background: #E1EAA9;
border: 2px solid #5A2C28; border: 2px solid #5A2C28;
border-radius: 10px; border-radius: 10px;
padding: 0.65rem; padding: 1rem;
display: grid; display: flex;
align-self: start; flex-direction: column;
align-content: start; gap: 0.75rem;
gap: 0.5rem;
} }
.import-card label { .import-card label {
color: #5A2C28; color: #5A2C28;
font-weight: 700; font-weight: 700;
margin-bottom: 0.25rem;
} }
input { .import-card textarea {
border: 2px solid #5A2C28; border: 2px solid #5A2C28;
border-radius: 10px; border-radius: 8px;
background: #B9DAD1;
padding: 0.6rem 0.75rem;
min-width: 180px;
}
textarea {
border: 2px solid #5A2C28;
border-radius: 10px;
background: #B9DAD1; background: #B9DAD1;
padding: 0.6rem 0.75rem; padding: 0.6rem 0.75rem;
resize: vertical; resize: vertical;
min-height: 80px; min-height: 100px;
font-family: inherit;
} }
button { .import-card input {
border: 2px solid #5A2C28; border: 2px solid #5A2C28;
border-radius: 10px; border-radius: 8px;
background: #B9DAD1;
padding: 0.6rem 0.75rem;
font-family: inherit;
}
.btn {
border: 2px solid #5A2C28;
border-radius: 8px;
background: #C19EF5; background: #C19EF5;
color: #5A2C28; color: #5A2C28;
padding: 0.6rem 1rem; padding: 0.6rem 1rem;
cursor: pointer; cursor: pointer;
font-weight: 600;
transition: background-color 0.2s, color 0.2s;
} }
button:hover { .btn:hover {
background: #BA6D4B; background: #BA6D4B;
color: #F3C8A0; color: #F3C8A0;
} }
.error { .alert {
margin-top: 0.5rem; border-radius: 8px;
color: #5A2C28; border: 2px solid #5A2C28;
font-weight: 700;
} }
@media (max-width: 920px) { @media (max-width: 991px) {
.content-layout { .game-card {
grid-template-columns: 1fr; padding: clamp(0.75rem, 1.5vw, 1rem);
grid-template-areas:
"center"
"fen"
"pgn";
} }
.center-column { .board-section {
grid-area: center; min-height: 350px;
} }
.fen-card { h1,
grid-area: fen; h2 {
} font-size: clamp(1.25rem, 3vw, 1.75rem);
}
.pgn-card { }
grid-area: pgn;
@media (max-width: 768px) {
.game-shell {
padding: clamp(0.5rem, 1.5vw, 1rem);
}
.game-card {
padding: clamp(0.5rem, 1vw, 0.75rem);
}
header {
margin-bottom: 1rem;
}
h1,
h2 {
font-size: 1.25rem;
}
.meta {
font-size: 0.85rem;
}
.top-section {
padding: 0.5rem;
margin-bottom: 0.75rem;
}
.move-form {
flex-wrap: wrap;
}
.move-form label {
flex-basis: 100%;
margin-bottom: 0.5rem;
}
.board-section {
min-height: 300px;
}
.import-card {
padding: 0.75rem;
gap: 0.5rem;
}
.import-card label {
font-size: 0.9rem;
}
.import-card textarea,
.import-card input {
min-height: 70px;
font-size: 0.9rem;
padding: 0.5rem;
}
.btn {
padding: 0.5rem 0.75rem;
font-size: 0.9rem;
}
}
@media (max-width: 480px) {
.game-shell {
padding: 0.5rem;
}
.game-card {
padding: 0.5rem;
border-radius: 8px;
}
header {
margin-bottom: 0.75rem;
}
h1 {
font-size: 1.1rem;
}
.meta {
font-size: 0.75rem;
}
.top-section {
padding: 0.4rem;
margin-bottom: 0.5rem;
}
.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;
} }
} }
+63 -46
View File
@@ -1,63 +1,80 @@
<main class="game-shell"> <main class="game-shell">
<section class="game-card"> <section class="game-card">
<header> <header class="mb-3">
<a routerLink="/" class="back-link">Back</a> <a routerLink="/" class="back-link">Back</a>
<h1>1 vs 1 Game</h1> <h1 class="mb-2">1 vs 1 Game</h1>
<p class="meta">Game ID: <strong>{{ facade.gameId }}</strong></p> <p class="meta mb-0">Game ID: <strong>{{ facade.gameId }}</strong></p>
</header> </header>
@if (facade.loading) { @if (facade.loading) {
<p>Loading game state...</p> <p>Loading game state...</p>
} @else if (facade.state) { } @else if (facade.state) {
<section class="content-layout"> <div class="container-fluid">
<aside class="import-card fen-card"> <div class="row g-3">
<label for="fenImport">Import FEN</label> <!-- Left Sidebar - FEN Import -->
<textarea <div class="col-lg-3 col-md-6 col-12 order-lg-1 order-2">
id="fenImport" <aside class="import-card fen-card h-100">
name="fenImport" <label for="fenImport">Import FEN</label>
[(ngModel)]="facade.fenInput" <textarea
rows="4" id="fenImport"
placeholder="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" name="fenImport"
></textarea> [(ngModel)]="facade.fenInput"
<button type="button" (click)="facade.importFen()">Load FEN</button> rows="4"
</aside> placeholder="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
></textarea>
<button type="button" class="btn w-100" (click)="facade.importFen()">Load FEN</button>
</aside>
</div>
<section class="center-column"> <!-- Center - Chess Board -->
<section class="top-section"> <div class="col-lg-6 col-md-12 col-12 order-lg-2 order-1">
<form class="move-form" (ngSubmit)="facade.submitMove()"> <section class="center-column d-flex flex-column h-100">
<label for="uciMove">Play move (UCI)</label> <div class="top-section mb-3">
<input id="uciMove" name="uciMove" [(ngModel)]="facade.moveInput" placeholder="e2e4" /> <form class="move-form d-flex flex-wrap gap-2 mb-2" (ngSubmit)="facade.submitMove()">
<button type="submit">Send Move</button> <label for="uciMove" class="form-label mb-0">Play move (UCI)</label>
</form> <input
<p class="board-hint">Click your piece to highlight legal targets.</p> id="uciMove"
</section> 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 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 <app-chess-board
[fen]="facade.state.fen" [fen]="facade.state.fen"
[selectedSquare]="facade.selectedSquare" [selectedSquare]="facade.selectedSquare"
[highlightedSquares]="facade.highlightedSquares" [highlightedSquares]="facade.highlightedSquares"
(squareSelected)="facade.onBoardSquareSelected($event)" (squareSelected)="facade.onBoardSquareSelected($event)"
/> />
</section> </div>
</section> </section>
</div>
<aside class="import-card pgn-card"> <!-- Right Sidebar - PGN Import -->
<label for="pgnImport">Import PGN</label> <div class="col-lg-3 col-md-6 col-12 order-lg-3 order-3">
<textarea <aside class="import-card pgn-card h-100">
id="pgnImport" <label for="pgnImport">Import PGN</label>
name="pgnImport" <textarea
[(ngModel)]="facade.pgnInput" id="pgnImport"
rows="4" name="pgnImport"
placeholder="1. e4 e5 2. Nf3 Nc6 *" [(ngModel)]="facade.pgnInput"
></textarea> rows="4"
<button type="button" (click)="facade.importPgn()">Load PGN</button> placeholder="1. e4 e5 2. Nf3 Nc6 *"
</aside> ></textarea>
</section> <button type="button" class="btn w-100" (click)="facade.importPgn()">Load PGN</button>
</aside>
</div>
</div>
</div>
} }
@if (facade.errorMessage) { @if (facade.errorMessage) {
<p class="error">{{ facade.errorMessage }}</p> <p class="alert alert-danger mt-3 mb-0">{{ facade.errorMessage }}</p>
} }
</section> </section>
</main> </main>
@@ -67,3 +67,77 @@ p {
font-weight: 700; font-weight: 700;
margin-top: 1rem; 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 { :root {
--warm-primary: #BA6D4B; --warm-primary: #BA6D4B;
--warm-dark: #5A2C28; --warm-dark: #5A2C28;