feat: NCS-63 User account implementation #2

Merged
shosho996 merged 26 commits from feat/NCS-66 into main 2026-05-06 10:51:30 +02:00
7 changed files with 150 additions and 178 deletions
Showing only changes of commit 13edcb2f69 - Show all commits
+1 -7
View File
@@ -8,11 +8,5 @@
"target": "http://localhost:8083", "target": "http://localhost:8083",
"secure": false, "secure": false,
"changeOrigin": true "changeOrigin": true
},
"/api": {
"target": "http://localhost:8080",
"secure": false,
"changeOrigin": true,
"ws": true
} }
} }
@@ -2,23 +2,11 @@
<label>{{ label }}</label> <label>{{ label }}</label>
@if (inputType === 'textarea') { @if (inputType === 'textarea') {
<textarea <textarea #textareaInput [placeholder]="placeholder" [value]="value" [rows]="rows"
#textareaInput (input)="onValueChange(textareaInput.value)" class="form-input"></textarea>
[placeholder]="placeholder"
[value]="value"
[rows]="rows"
(input)="onValueChange(textareaInput.value)"
class="form-input"
></textarea>
} @else { } @else {
<input <input #textInput type="text" [placeholder]="placeholder" [value]="value" (input)="onValueChange(textInput.value)"
#textInput class="form-input" />
type="text"
[placeholder]="placeholder"
[value]="value"
(input)="onValueChange(textInput.value)"
class="form-input"
/>
} }
<button type="button" class="app-btn w-100" (click)="onButtonClick()"> <button type="button" class="app-btn w-100" (click)="onButtonClick()">
@@ -26,6 +14,6 @@
</button> </button>
@if (hintText) { @if (hintText) {
<p class="hint-text">{{ hintText }}</p> <p class="hint-text">{{ hintText }}</p>
} }
</section> </section>
@@ -2,26 +2,22 @@
<div class="promotion-dialog"> <div class="promotion-dialog">
<div class="promotion-header"> <div class="promotion-header">
<h3>Pawn Promotion</h3> <h3>Pawn Promotion</h3>
<button class="app-btn" (click)="close()" aria-label="Close" style="padding:0.2rem 0.5rem;min-width:unset;">&times;</button> <button class="app-btn" (click)="close()" aria-label="Close"
style="padding:0.2rem 0.5rem;min-width:unset;">&times;</button>
</div> </div>
<div class="promotion-body"> <div class="promotion-body">
<p class="promotion-prompt">Choose a piece to promote your pawn to:</p> <p class="promotion-prompt">Choose a piece to promote your pawn to:</p>
<div class="promotion-options"> <div class="promotion-options">
@for (piece of promotionPieces; track piece.type) { @for (piece of promotionPieces; track piece.type) {
<button <button type="button" class="app-btn promotion-choice" [attr.data-piece]="piece.type"
type="button" (click)="selectPromotion(piece.type)" [title]="piece.label">
class="app-btn promotion-choice" <span class="piece-symbol">{{ piece.symbol }}</span>
[attr.data-piece]="piece.type" <span class="piece-label">{{ piece.label }}</span>
(click)="selectPromotion(piece.type)" </button>
[title]="piece.label"
>
<span class="piece-symbol">{{ piece.symbol }}</span>
<span class="piece-label">{{ piece.label }}</span>
</button>
} }
</div> </div>
</div> </div>
</div> </div>
</div> </div>
+26
View File
@@ -30,6 +30,7 @@
header { header {
margin-bottom: var(--size-xl); margin-bottom: var(--size-xl);
margin-bottom: var(--size-xl);
} }
h1, h1,
@@ -37,9 +38,13 @@ h2 {
color: var(--color-text-primary); color: var(--color-text-primary);
margin: 0 0 var(--size-md); margin: 0 0 var(--size-md);
font-size: var(--heading-h1); font-size: var(--heading-h1);
color: var(--color-text-primary);
margin: 0 0 var(--size-md);
font-size: var(--heading-h1);
} }
.meta { .meta {
color: var(--color-text-primary);
color: var(--color-text-primary); color: var(--color-text-primary);
font-size: 0.95rem; font-size: 0.95rem;
} }
@@ -48,6 +53,8 @@ h2 {
display: inline-block; display: inline-block;
margin-bottom: var(--size-sm); margin-bottom: var(--size-sm);
color: var(--color-text-primary); color: var(--color-text-primary);
margin-bottom: var(--size-sm);
color: var(--color-text-primary);
text-decoration: none; text-decoration: none;
font-weight: 600; font-weight: 600;
} }
@@ -110,6 +117,10 @@ h2 {
} }
.board-section { .board-section {
background: var(--color-bg-board);
border: var(--border-width) solid var(--color-border);
border-radius: var(--border-radius-md);
padding: clamp(var(--size-sm), 1vw, var(--size-lg));
background: var(--color-bg-board); background: var(--color-bg-board);
border: var(--border-width) solid var(--color-border); border: var(--border-width) solid var(--color-border);
border-radius: var(--border-radius-md); border-radius: var(--border-radius-md);
@@ -316,6 +327,7 @@ h2 {
@media (max-width: 991px) { @media (max-width: 991px) {
.game-card { .game-card {
padding: clamp(var(--size-md), 1.5vw, var(--size-lg)); padding: clamp(var(--size-md), 1.5vw, var(--size-lg));
padding: clamp(var(--size-md), 1.5vw, var(--size-lg));
} }
.board-section { .board-section {
@@ -325,25 +337,30 @@ h2 {
h1, h1,
h2 { h2 {
font-size: var(--heading-h1-tablet); font-size: var(--heading-h1-tablet);
font-size: var(--heading-h1-tablet);
} }
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.game-shell { .game-shell {
padding: clamp(var(--size-sm), 1.5vw, var(--size-lg)); padding: clamp(var(--size-sm), 1.5vw, var(--size-lg));
padding: clamp(var(--size-sm), 1.5vw, var(--size-lg));
} }
.game-card { .game-card {
padding: clamp(var(--size-sm), 1vw, var(--size-md)); padding: clamp(var(--size-sm), 1vw, var(--size-md));
padding: clamp(var(--size-sm), 1vw, var(--size-md));
} }
header { header {
margin-bottom: var(--size-lg); margin-bottom: var(--size-lg);
margin-bottom: var(--size-lg);
} }
h1, h1,
h2 { h2 {
font-size: var(--heading-h1-mobile); font-size: var(--heading-h1-mobile);
font-size: var(--heading-h1-mobile);
} }
.meta { .meta {
@@ -353,6 +370,8 @@ h2 {
.top-section { .top-section {
gap: var(--size-xs); gap: var(--size-xs);
margin-bottom: var(--size-xs); margin-bottom: var(--size-xs);
gap: var(--size-xs);
margin-bottom: var(--size-xs);
} }
.board-section { .board-section {
@@ -363,19 +382,24 @@ h2 {
@media (max-width: 480px) { @media (max-width: 480px) {
.game-shell { .game-shell {
padding: var(--size-sm); padding: var(--size-sm);
padding: var(--size-sm);
} }
.game-card { .game-card {
padding: var(--size-sm); padding: var(--size-sm);
border-radius: var(--border-radius-md); border-radius: var(--border-radius-md);
padding: var(--size-sm);
border-radius: var(--border-radius-md);
} }
header { header {
margin-bottom: var(--size-md); margin-bottom: var(--size-md);
margin-bottom: var(--size-md);
} }
h1 { h1 {
font-size: var(--heading-h1-small); font-size: var(--heading-h1-small);
font-size: var(--heading-h1-small);
} }
.meta { .meta {
@@ -385,6 +409,8 @@ h2 {
.top-section { .top-section {
gap: var(--size-xs-gap); gap: var(--size-xs-gap);
margin-bottom: var(--size-xs); margin-bottom: var(--size-xs);
gap: var(--size-xs-gap);
margin-bottom: var(--size-xs);
} }
.board-section { .board-section {
+104 -131
View File
@@ -1,9 +1,6 @@
<main class="game-shell" [class.theme-dark]="isDarkMode"> <main class="game-shell" [class.theme-dark]="isDarkMode">
<app-promotion-dialog <app-promotion-dialog [isOpen]="facade.isPromotionDialogOpen" (promotionSelected)="facade.onPromotionSelected($event)"
[isOpen]="facade.isPromotionDialogOpen" (closed)="facade.onPromotionClosed()" />
(promotionSelected)="facade.onPromotionSelected($event)"
(closed)="facade.onPromotionClosed()"
/>
<section class="game-card"> <section class="game-card">
<header class="mb-3"> <header class="mb-3">
@@ -13,150 +10,126 @@
</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) {
@if (facade.isGameFinished && facade.gameCompletionMessage) { @if (facade.isGameFinished && facade.gameCompletionMessage) {
<div class="game-completion-alert alert alert-success mb-3"> <div class="game-completion-alert alert alert-success mb-3">
<h2 class="completion-title">{{ facade.gameCompletionMessage }}</h2> <h2 class="completion-title">{{ facade.gameCompletionMessage }}</h2>
<p class="completion-subtitle mb-0"> <p class="completion-subtitle mb-0">
<a routerLink="/" class="completion-link">Start a new game</a> <a routerLink="/" class="completion-link">Start a new game</a>
</p> </p>
</div>
}
@if (facade.isGameFinished && facade.gameCompletionMessage) {
<div class="game-completion-alert alert alert-success mb-3">
<h2 class="completion-title">{{ facade.gameCompletionMessage }}</h2>
<p class="completion-subtitle mb-0">
<a routerLink="/" class="completion-link">Start a new game</a>
</p>
</div>
}
<div class="container-fluid">
<div class="row g-3">
<!-- Left Sidebar - Dummy Timers -->
<div class="col-lg-3 col-md-6 col-12 order-lg-1 order-2">
<section class="timer-card">
<h2>Timers</h2>
<div class="player-timer" [class.active-timer]="facade.state.turn === 'white'">
<p class="timer-label">White</p>
<p class="timer-value">{{ formatTimer(whiteTimerSeconds) }}</p>
</div>
<div class="player-timer" [class.active-timer]="facade.state.turn === 'black'">
<p class="timer-label">Black</p>
<p class="timer-value">{{ formatTimer(blackTimerSeconds) }}</p>
</div>
</section>
</div> </div>
}
<div class="container-fluid">
<div class="row g-3">
<!-- Left Sidebar - Dummy Timers -->
<div class="col-lg-3 col-md-6 col-12 order-lg-1 order-2">
<section class="timer-card">
<h2>Timers</h2>
<div class="player-timer" [class.active-timer]="facade.state.turn === 'white'">
<p class="timer-label">White</p>
<p class="timer-value">{{ formatTimer(whiteTimerSeconds) }}</p>
</div>
<div class="player-timer" [class.active-timer]="facade.state.turn === 'black'">
<p class="timer-label">Black</p>
<p class="timer-value">{{ formatTimer(blackTimerSeconds) }}</p>
</div>
</section>
</div>
<!-- Center - Chess Board --> <!-- Center - Chess Board -->
<div class="col-lg-6 col-md-12 col-12 order-lg-2 order-1"> <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"> <section class="center-column d-flex flex-column h-100">
<div class="board-section flex-grow-1 d-flex align-items-center justify-content-center"> <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" [selectedSquare]="facade.selectedSquare"
[fen]="facade.state.fen" [highlightedSquares]="facade.highlightedSquares" [boardTheme]="boardTheme"
[selectedSquare]="facade.selectedSquare" (squareSelected)="facade.onBoardSquareSelected($event)" />
[highlightedSquares]="facade.highlightedSquares" </div>
[boardTheme]="boardTheme"
(squareSelected)="facade.onBoardSquareSelected($event)"
/>
</div>
<section class="top-section"> <section class="top-section">
<section class="board-theme-card" aria-label="Board design chooser"> <section class="board-theme-card" aria-label="Board design chooser">
<h3>Board Design</h3> <h3>Board Design</h3>
<div class="board-theme-group" role="radiogroup" aria-label="Board design"> <div class="board-theme-group" role="radiogroup" aria-label="Board design">
<label class="board-theme-option"> <label class="board-theme-option">
<input <input type="radio" name="boardTheme" [checked]="boardTheme === 'arabian'"
type="radio" (change)="setBoardTheme('arabian')" />
name="boardTheme" <span>Arabian</span>
[checked]="boardTheme === 'arabian'" </label>
(change)="setBoardTheme('arabian')"
/>
<span>Arabian</span>
</label>
<label class="board-theme-option"> <label class="board-theme-option">
<input <input type="radio" name="boardTheme" [checked]="boardTheme === 'classic'"
type="radio" (change)="setBoardTheme('classic')" />
name="boardTheme" <span>Classic</span>
[checked]="boardTheme === 'classic'" </label>
(change)="setBoardTheme('classic')" </div>
/>
<span>Classic</span>
</label>
</div>
</section>
<app-input-card
label="Play move (UCI)"
placeholder="e2e4"
buttonLabel="Send Move"
inputType="input"
[value]="facade.moveInput"
cardClass="move-card"
hintText="Click your piece to highlight legal targets."
(valueChange)="facade.moveInput = $event"
(buttonClick)="facade.submitMove()"
/>
</section> </section>
<app-input-card label="Play move (UCI)" placeholder="e2e4" buttonLabel="Send Move" inputType="input"
[value]="facade.moveInput" cardClass="move-card" hintText="Click your piece to highlight legal targets."
(valueChange)="facade.moveInput = $event" (buttonClick)="facade.submitMove()" />
</section> </section>
</div> </section>
</div>
<!-- Right Sidebar - Export --> <!-- Right Sidebar - Export -->
<div class="col-lg-3 col-md-6 col-12 order-lg-3 order-3"> <div class="col-lg-3 col-md-6 col-12 order-lg-3 order-3">
<section class="history-card"> <section class="history-card">
<h2>Move History</h2> <h2>Move History</h2>
@if (facade.state.moves.length === 0) { @if (facade.state.moves.length === 0) {
<p class="history-empty">No moves yet.</p> <p class="history-empty">No moves yet.</p>
} @else { } @else {
<ol class="history-list"> <ol class="history-list">
@for (move of facade.state.moves; track $index) { @for (move of facade.state.moves; track $index) {
<li> <li>
<span class="history-number">{{ $index + 1 }}.</span> <span class="history-number">{{ $index + 1 }}.</span>
<span class="history-move">{{ move }}</span> <span class="history-move">{{ move }}</span>
</li> </li>
}
</ol>
} }
</section> </ol>
}
</section>
<section class="export-card"> <section class="export-card">
<h2>Export</h2> <h2>Export</h2>
<div class="export-mode-group" role="radiogroup" aria-label="Export mode"> <div class="export-mode-group" role="radiogroup" aria-label="Export mode">
<label class="export-mode-option"> <label class="export-mode-option">
<input <input type="radio" name="exportType" [checked]="exportType === 'fen'"
type="radio" (change)="setExportType('fen')" />
name="exportType" <span>FEN</span>
[checked]="exportType === 'fen'" </label>
(change)="setExportType('fen')" <label class="export-mode-option">
/> <input type="radio" name="exportType" [checked]="exportType === 'pgn'"
<span>FEN</span> (change)="setExportType('pgn')" />
</label> <span>PGN</span>
<label class="export-mode-option"> </label>
<input </div>
type="radio"
name="exportType"
[checked]="exportType === 'pgn'"
(change)="setExportType('pgn')"
/>
<span>PGN</span>
</label>
</div>
<textarea <textarea class="export-text" [value]="exportValue"
class="export-text" [placeholder]="exportType === 'fen' ? 'FEN will appear here' : 'PGN will appear here'" rows="8"
[value]="exportValue" readonly></textarea>
[placeholder]="exportType === 'fen' ? 'FEN will appear here' : 'PGN will appear here'"
rows="8"
readonly
></textarea>
<button type="button" class="app-btn w-100" (click)="completeExport()">Done</button> <button type="button" class="app-btn w-100" (click)="completeExport()">Done</button>
@if (exportNotice) { @if (exportNotice) {
<p class="export-note">{{ exportNotice }}</p> <p class="export-note">{{ exportNotice }}</p>
} }
</section> </section>
</div>
</div> </div>
</div> </div>
</div>
} }
@if (facade.errorMessage) { @if (facade.errorMessage) {
<p class="alert alert-danger mt-3 mb-0">{{ facade.errorMessage }}</p> <p class="alert alert-danger mt-3 mb-0">{{ facade.errorMessage }}</p>
} }
</section> </section>
</main> </main>
+3 -5
View File
@@ -33,7 +33,7 @@
</div> </div>
</div> </div>
<div class="bpart" style="height:36vh;"> <div class="bpart" style="height:36vh;">
<div style="padding:5px 5px 0;"> <div>
<div class="bb"> <div class="bb">
<div class="bb-tag">JOIN</div> <div class="bb-tag">JOIN</div>
<div class="bb-title">JOIN<br />GAME</div> <div class="bb-title">JOIN<br />GAME</div>
@@ -94,8 +94,7 @@
<div class="bb-tag">WELCOME</div> <div class="bb-tag">WELCOME</div>
<div class="bb-title" style="font-size:clamp(16px,1.8vw,26px);">WELCOME TO<br />NOWCHESS</div> <div class="bb-title" style="font-size:clamp(16px,1.8vw,26px);">WELCOME TO<br />NOWCHESS</div>
<div class="bb-subtitle">Play your next move from the skyline.</div> <div class="bb-subtitle">Play your next move from the skyline.</div>
<button type="button" class="app-btn" (click)="startOneVsOne()" <button type="button" class="app-btn" (click)="startOneVsOne()" [disabled]="creating">
[disabled]="creating">
{{ creating ? 'CREATING...' : 'START NOW →' }} {{ creating ? 'CREATING...' : 'START NOW →' }}
</button> </button>
</div> </div>
@@ -248,8 +247,7 @@
[placeholder]="importMode === 'fen' ? 'Paste FEN here' : 'Paste PGN here'" [disabled]="importing" [placeholder]="importMode === 'fen' ? 'Paste FEN here' : 'Paste PGN here'" [disabled]="importing"
rows="5"></textarea> rows="5"></textarea>
<div class="dialog-actions"> <div class="dialog-actions">
<button type="button" class="app-btn" (click)="submitImportGame()" <button type="button" class="app-btn" (click)="submitImportGame()" [disabled]="importing || !importText.trim()">
[disabled]="importing || !importText.trim()">
{{ importing ? 'IMPORTING...' : 'IMPORT' }} {{ importing ? 'IMPORTING...' : 'IMPORT' }}
</button> </button>
<button type="button" class="app-btn" (click)="closeImportDialog()" [disabled]="importing">CANCEL</button> <button type="button" class="app-btn" (click)="closeImportDialog()" [disabled]="importing">CANCEL</button>
-3
View File
@@ -1,6 +1,3 @@
/* ========================================
COLOR VARIABLES - Semantic Naming
======================================== */
/* Light Mode Colors (Default) */ /* Light Mode Colors (Default) */
:root:not([data-theme='dark']) { :root:not([data-theme='dark']) {