fix: NCWF-4 Token Issues (#8)
Co-authored-by: Lala, Shahd <Shahd.Lala@sybit.de> Co-authored-by: shahdlala66 <shahd.lala66@gmail.com> Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
@@ -1,58 +1,293 @@
|
||||
@import '../../button-template.css';
|
||||
:host {
|
||||
--auth-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
--auth-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
|
||||
--auth-neon: #ff45c8;
|
||||
--auth-neon-soft: rgba(255, 69, 200, 0.55);
|
||||
--auth-bg: #06060d;
|
||||
}
|
||||
|
||||
.dialog-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(2, 2, 10, 0.58);
|
||||
background: rgba(4, 2, 12, 0.72);
|
||||
backdrop-filter: blur(6px);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
z-index: 350;
|
||||
padding: 1rem;
|
||||
animation: backdrop-in 180ms ease-out both;
|
||||
}
|
||||
|
||||
.dialog-card {
|
||||
width: min(460px, 100%);
|
||||
background: var(--dlg-bg);
|
||||
border: 1.5px solid var(--dlg-border);
|
||||
box-shadow: var(--bb-glow);
|
||||
border-radius: 4px;
|
||||
padding: 1rem;
|
||||
position: relative;
|
||||
width: min(420px, 100%);
|
||||
background:
|
||||
radial-gradient(120% 80% at 50% 0%, rgba(255, 69, 200, 0.10), transparent 60%),
|
||||
linear-gradient(180deg, #0a0612 0%, #06060d 100%);
|
||||
border: 1px solid var(--auth-neon-soft);
|
||||
border-radius: 14px;
|
||||
padding: 28px 26px 22px;
|
||||
display: grid;
|
||||
gap: 0.7rem;
|
||||
gap: 14px;
|
||||
font-family: var(--auth-sans);
|
||||
color: #fff;
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(255, 69, 200, 0.06) inset,
|
||||
0 0 30px rgba(255, 69, 200, 0.18),
|
||||
0 30px 60px rgba(0, 0, 0, 0.55);
|
||||
overflow: hidden;
|
||||
animation: dialog-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
|
||||
}
|
||||
|
||||
.dialog-card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
transparent 0%,
|
||||
rgba(255, 69, 200, 0.06) 50%,
|
||||
transparent 100%
|
||||
);
|
||||
height: 35%;
|
||||
animation: scanline 4.5s linear infinite;
|
||||
mix-blend-mode: screen;
|
||||
}
|
||||
|
||||
.dialog-card::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background-image:
|
||||
repeating-linear-gradient(
|
||||
0deg,
|
||||
rgba(255, 255, 255, 0.012) 0px,
|
||||
rgba(255, 255, 255, 0.012) 1px,
|
||||
transparent 1px,
|
||||
transparent 3px
|
||||
);
|
||||
border-radius: inherit;
|
||||
}
|
||||
|
||||
.dialog-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.brand-tag {
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 10px;
|
||||
letter-spacing: 2.5px;
|
||||
color: var(--auth-neon);
|
||||
text-transform: uppercase;
|
||||
opacity: 0.85;
|
||||
animation: pulse-glow 2.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.brand-tag::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--auth-neon);
|
||||
margin-right: 8px;
|
||||
vertical-align: 1px;
|
||||
box-shadow: 0 0 8px var(--auth-neon);
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
background: transparent;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
color: rgba(255, 255, 255, 0.65);
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
transition: all 0.18s ease;
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
color: var(--auth-neon);
|
||||
border-color: var(--auth-neon-soft);
|
||||
box-shadow: 0 0 10px rgba(255, 69, 200, 0.35);
|
||||
}
|
||||
|
||||
.dialog-title {
|
||||
font-family: 'Bebas Neue', sans-serif;
|
||||
font-size: 22px;
|
||||
letter-spacing: 2px;
|
||||
color: var(--bb-title);
|
||||
text-align: center;
|
||||
font-family: var(--auth-sans);
|
||||
font-weight: 700;
|
||||
font-size: 26px;
|
||||
letter-spacing: 0.5px;
|
||||
color: #fff;
|
||||
margin: 4px 0 0;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.dialog-subtitle {
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
letter-spacing: 0.6px;
|
||||
margin-bottom: 6px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
form {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.field {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 10px;
|
||||
letter-spacing: 1.5px;
|
||||
text-transform: uppercase;
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
}
|
||||
|
||||
.dialog-input {
|
||||
width: 100%;
|
||||
background: rgba(4, 4, 20, 0.62);
|
||||
border: 1px solid var(--bb-border);
|
||||
color: var(--bb-title);
|
||||
border-radius: 2px;
|
||||
padding: 0.6rem 0.7rem;
|
||||
font-family: 'Space Mono', monospace;
|
||||
background: rgba(8, 5, 20, 0.6);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 12px 14px;
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.3px;
|
||||
transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
|
||||
}
|
||||
|
||||
.dialog-input::placeholder {
|
||||
color: rgba(255, 255, 255, 0.28);
|
||||
}
|
||||
|
||||
.dialog-input:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px rgba(0, 213, 255, 0.25);
|
||||
}
|
||||
|
||||
.dialog-textarea {
|
||||
min-height: 120px;
|
||||
resize: vertical;
|
||||
border-color: var(--auth-neon);
|
||||
background: rgba(20, 6, 26, 0.7);
|
||||
box-shadow: 0 0 0 3px rgba(255, 69, 200, 0.15), 0 0 18px rgba(255, 69, 200, 0.18);
|
||||
}
|
||||
|
||||
.text-danger {
|
||||
color: #dc3545;
|
||||
font-size: 0.875rem;
|
||||
color: #ff6ea0;
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.error-banner {
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 69, 110, 0.08);
|
||||
border: 1px solid rgba(255, 69, 110, 0.35);
|
||||
color: #ff9bb4;
|
||||
animation: shake 0.35s ease-out;
|
||||
}
|
||||
|
||||
.dialog-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 6px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
border-radius: 10px;
|
||||
padding: 12px 14px;
|
||||
font-family: var(--auth-sans);
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.4px;
|
||||
cursor: pointer;
|
||||
transition: all 0.18s ease;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn-ghost {
|
||||
background: transparent;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
.btn-ghost:hover:not(:disabled) {
|
||||
color: #fff;
|
||||
border-color: rgba(255, 255, 255, 0.25);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--auth-neon);
|
||||
border: 1px solid var(--auth-neon);
|
||||
color: #1a0210;
|
||||
box-shadow: 0 0 18px rgba(255, 69, 200, 0.45);
|
||||
}
|
||||
|
||||
.btn-primary:hover:not(:disabled) {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 0 26px rgba(255, 69, 200, 0.7);
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.alt-line {
|
||||
margin-top: 4px;
|
||||
text-align: center;
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.alt-line a {
|
||||
color: var(--auth-neon);
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.alt-line a:hover {
|
||||
text-shadow: 0 0 8px var(--auth-neon-soft);
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 2px solid rgba(26, 2, 16, 0.35);
|
||||
border-top-color: #1a0210;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.7s linear infinite;
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
@@ -66,3 +301,28 @@
|
||||
white-space: nowrap !important;
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
@keyframes scanline {
|
||||
0% { transform: translateY(-100%); }
|
||||
100% { transform: translateY(300%); }
|
||||
}
|
||||
@keyframes pulse-glow {
|
||||
0%, 100% { opacity: 0.85; }
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
@keyframes dialog-in {
|
||||
from { opacity: 0; transform: translateY(8px) scale(0.96); }
|
||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||
}
|
||||
@keyframes backdrop-in {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
@keyframes shake {
|
||||
0%, 100% { transform: translateX(0); }
|
||||
20%, 60% { transform: translateX(-4px); }
|
||||
40%, 80% { transform: translateX(4px); }
|
||||
}
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
@@ -1,34 +1,49 @@
|
||||
<div class="dialog-overlay" (click)="closeDialog()">
|
||||
<div class="dialog-card" (click)="$event.stopPropagation()">
|
||||
<div class="dialog-title">LOGIN</div>
|
||||
<div class="dialog-head">
|
||||
<span class="brand-tag">NowChess // Auth</span>
|
||||
<button type="button" class="close-btn" (click)="closeDialog()" aria-label="Close">×</button>
|
||||
</div>
|
||||
|
||||
<h2 class="dialog-title">Welcome back</h2>
|
||||
<div class="dialog-subtitle">Sign in to continue your match</div>
|
||||
|
||||
<form [formGroup]="loginForm" (ngSubmit)="onSubmit()">
|
||||
<label for="username" class="sr-only">Username</label>
|
||||
<input id="username" type="text" class="dialog-input" formControlName="username" placeholder="Username" />
|
||||
@if (loginForm.get('username')?.invalid && loginForm.get('username')?.touched) {
|
||||
<small class="text-danger">Username must be at least 3 characters</small>
|
||||
}
|
||||
<div class="field">
|
||||
<label for="username" class="field-label">Username</label>
|
||||
<input id="username" type="text" class="dialog-input" formControlName="username"
|
||||
placeholder="your_handle" autocomplete="username" />
|
||||
@if (loginForm.get('username')?.invalid && loginForm.get('username')?.touched) {
|
||||
<small class="text-danger">Username must be at least 3 characters</small>
|
||||
}
|
||||
</div>
|
||||
|
||||
<label for="password" class="sr-only">Password</label>
|
||||
<input id="password" type="password" class="dialog-input" formControlName="password" placeholder="Password" />
|
||||
@if (loginForm.get('password')?.invalid && loginForm.get('password')?.touched) {
|
||||
<small class="text-danger">Password must be at least 6 characters</small>
|
||||
}
|
||||
<div class="field">
|
||||
<label for="password" class="field-label">Password</label>
|
||||
<input id="password" type="password" class="dialog-input" formControlName="password"
|
||||
placeholder="••••••••" autocomplete="current-password" />
|
||||
@if (loginForm.get('password')?.invalid && loginForm.get('password')?.touched) {
|
||||
<small class="text-danger">Password must be at least 6 characters</small>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (errorMessage) {
|
||||
<div class="error-banner">{{ errorMessage }}</div>
|
||||
<div class="error-banner">{{ errorMessage }}</div>
|
||||
}
|
||||
|
||||
<div class="dialog-actions">
|
||||
<button type="button" class="app-btn" (click)="openRegister()">Create account</button>
|
||||
<button type="button" class="app-btn" (click)="closeDialog()">Cancel</button>
|
||||
<button type="submit" class="app-btn" [disabled]="isLoading || loginForm.invalid">
|
||||
<button type="button" class="btn btn-ghost" (click)="closeDialog()">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary" [disabled]="isLoading || loginForm.invalid">
|
||||
@if (isLoading) {
|
||||
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
|
||||
<span class="spinner" aria-hidden="true"></span>
|
||||
}
|
||||
Login
|
||||
{{ isLoading ? 'Signing in…' : 'Sign in' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="alt-line">
|
||||
New here?<a (click)="openRegister()">Create an account</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -88,6 +88,11 @@
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.live-label.reviewing {
|
||||
color: var(--nc-warning);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.moves::-webkit-scrollbar { width: 6px; }
|
||||
.moves::-webkit-scrollbar-track { background: transparent; }
|
||||
.moves::-webkit-scrollbar-thumb { background: var(--nc-border-strong); border-radius: 3px; }
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
<div class="moves" role="list">
|
||||
<div class="moves" role="list" #movesEl>
|
||||
@if (movePairs.length === 0) {
|
||||
<div class="moves-empty">No moves yet.</div>
|
||||
} @else {
|
||||
@for (pair of movePairs; track $index) {
|
||||
<div class="mv-num" role="presentation">{{ $index + 1 }}</div>
|
||||
<div class="mv" [class.current]="currentWhiteIndex === $index" role="listitem">
|
||||
<div class="mv" [class.current]="isWhiteViewing($index)" role="listitem"
|
||||
tabindex="0" (click)="clickWhite($index)" (keydown.enter)="clickWhite($index)">
|
||||
{{ pair.white }}
|
||||
</div>
|
||||
<div class="mv" [class.current]="currentBlackIndex === $index" [class.mv-empty]="!pair.black" role="listitem">
|
||||
<div class="mv" [class.current]="isBlackViewing($index)" [class.mv-empty]="!pair.black" role="listitem"
|
||||
[attr.tabindex]="pair.black ? 0 : null"
|
||||
(click)="clickBlack($index, pair.black)" (keydown.enter)="clickBlack($index, pair.black)">
|
||||
{{ pair.black ?? '…' }}
|
||||
</div>
|
||||
}
|
||||
@@ -31,13 +34,13 @@
|
||||
<polyline points="9 18 15 12 9 6"/>
|
||||
</svg>
|
||||
</button>
|
||||
<button class="icon-btn" title="Last move" (click)="navigate.emit('last')">
|
||||
<button class="icon-btn" title="Last move / return to live" (click)="navigate.emit('last')">
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<polyline points="13 17 18 12 13 7"/><polyline points="6 17 11 12 6 7"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
@if (plyCount > 0) {
|
||||
<span class="live-label">LIVE</span>
|
||||
<span class="live-label" [class.reviewing]="!isLive">{{ isLive ? 'LIVE' : 'REVIEWING' }}</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { Component, ElementRef, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core';
|
||||
|
||||
export type MoveNavDirection = 'first' | 'prev' | 'next' | 'last';
|
||||
|
||||
@@ -16,7 +16,11 @@ interface MovePair {
|
||||
})
|
||||
export class MoveHistoryComponent implements OnChanges {
|
||||
@Input({ required: true }) moves: string[] = [];
|
||||
@Input() viewingPly: number | null = null;
|
||||
@Output() navigate = new EventEmitter<MoveNavDirection>();
|
||||
@Output() navigateToPly = new EventEmitter<number>();
|
||||
|
||||
@ViewChild('movesEl') movesEl?: ElementRef<HTMLElement>;
|
||||
|
||||
movePairs: MovePair[] = [];
|
||||
|
||||
@@ -24,24 +28,33 @@ export class MoveHistoryComponent implements OnChanges {
|
||||
return this.moves.length;
|
||||
}
|
||||
|
||||
get currentWhiteIndex(): number {
|
||||
const lastPairIndex = this.movePairs.length - 1;
|
||||
if (lastPairIndex < 0) return -1;
|
||||
const lastMove = this.moves.length - 1;
|
||||
return lastMove % 2 === 0 ? lastPairIndex : -1;
|
||||
}
|
||||
|
||||
get currentBlackIndex(): number {
|
||||
const lastPairIndex = this.movePairs.length - 1;
|
||||
if (lastPairIndex < 0) return -1;
|
||||
const lastMove = this.moves.length - 1;
|
||||
return lastMove % 2 === 1 ? lastPairIndex : -1;
|
||||
get isLive(): boolean {
|
||||
return this.viewingPly === null || this.viewingPly >= this.moves.length - 1;
|
||||
}
|
||||
|
||||
ngOnChanges(): void {
|
||||
this.movePairs = this.buildPairs(this.moves);
|
||||
}
|
||||
|
||||
isWhiteViewing(pairIndex: number): boolean {
|
||||
const ply = this.viewingPly ?? this.moves.length - 1;
|
||||
return ply === pairIndex * 2;
|
||||
}
|
||||
|
||||
isBlackViewing(pairIndex: number): boolean {
|
||||
const ply = this.viewingPly ?? this.moves.length - 1;
|
||||
return ply === pairIndex * 2 + 1;
|
||||
}
|
||||
|
||||
clickWhite(pairIndex: number): void {
|
||||
this.navigateToPly.emit(pairIndex * 2);
|
||||
}
|
||||
|
||||
clickBlack(pairIndex: number, black: string | null): void {
|
||||
if (!black) return;
|
||||
this.navigateToPly.emit(pairIndex * 2 + 1);
|
||||
}
|
||||
|
||||
private buildPairs(moves: string[]): MovePair[] {
|
||||
const pairs: MovePair[] = [];
|
||||
for (let i = 0; i < moves.length; i += 2) {
|
||||
|
||||
@@ -1,58 +1,298 @@
|
||||
@import '../../button-template.css';
|
||||
:host {
|
||||
--auth-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
--auth-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
|
||||
--auth-neon: #ff45c8;
|
||||
--auth-neon-soft: rgba(255, 69, 200, 0.55);
|
||||
--auth-bg: #06060d;
|
||||
}
|
||||
|
||||
.dialog-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(2, 2, 10, 0.58);
|
||||
background: rgba(4, 2, 12, 0.72);
|
||||
backdrop-filter: blur(6px);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
z-index: 350;
|
||||
padding: 1rem;
|
||||
animation: backdrop-in 180ms ease-out both;
|
||||
}
|
||||
|
||||
.dialog-card {
|
||||
width: min(460px, 100%);
|
||||
background: var(--dlg-bg);
|
||||
border: 1.5px solid var(--dlg-border);
|
||||
box-shadow: var(--bb-glow);
|
||||
border-radius: 4px;
|
||||
padding: 1rem;
|
||||
position: relative;
|
||||
width: min(440px, 100%);
|
||||
background:
|
||||
radial-gradient(120% 80% at 50% 0%, rgba(255, 69, 200, 0.10), transparent 60%),
|
||||
linear-gradient(180deg, #0a0612 0%, #06060d 100%);
|
||||
border: 1px solid var(--auth-neon-soft);
|
||||
border-radius: 14px;
|
||||
padding: 28px 26px 22px;
|
||||
display: grid;
|
||||
gap: 0.7rem;
|
||||
gap: 14px;
|
||||
font-family: var(--auth-sans);
|
||||
color: #fff;
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(255, 69, 200, 0.06) inset,
|
||||
0 0 30px rgba(255, 69, 200, 0.18),
|
||||
0 30px 60px rgba(0, 0, 0, 0.55);
|
||||
overflow: hidden;
|
||||
animation: dialog-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
|
||||
}
|
||||
|
||||
.dialog-card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
transparent 0%,
|
||||
rgba(255, 69, 200, 0.06) 50%,
|
||||
transparent 100%
|
||||
);
|
||||
height: 35%;
|
||||
animation: scanline 4.5s linear infinite;
|
||||
mix-blend-mode: screen;
|
||||
}
|
||||
|
||||
.dialog-card::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background-image: repeating-linear-gradient(
|
||||
0deg,
|
||||
rgba(255, 255, 255, 0.012) 0px,
|
||||
rgba(255, 255, 255, 0.012) 1px,
|
||||
transparent 1px,
|
||||
transparent 3px
|
||||
);
|
||||
border-radius: inherit;
|
||||
}
|
||||
|
||||
.dialog-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.brand-tag {
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 10px;
|
||||
letter-spacing: 2.5px;
|
||||
color: var(--auth-neon);
|
||||
text-transform: uppercase;
|
||||
opacity: 0.85;
|
||||
animation: pulse-glow 2.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.brand-tag::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--auth-neon);
|
||||
margin-right: 8px;
|
||||
vertical-align: 1px;
|
||||
box-shadow: 0 0 8px var(--auth-neon);
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
background: transparent;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
color: rgba(255, 255, 255, 0.65);
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
transition: all 0.18s ease;
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
color: var(--auth-neon);
|
||||
border-color: var(--auth-neon-soft);
|
||||
box-shadow: 0 0 10px rgba(255, 69, 200, 0.35);
|
||||
}
|
||||
|
||||
.dialog-title {
|
||||
font-family: 'Bebas Neue', sans-serif;
|
||||
font-size: 22px;
|
||||
letter-spacing: 2px;
|
||||
color: var(--bb-title);
|
||||
text-align: center;
|
||||
font-family: var(--auth-sans);
|
||||
font-weight: 700;
|
||||
font-size: 26px;
|
||||
letter-spacing: 0.5px;
|
||||
color: #fff;
|
||||
margin: 4px 0 0;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.dialog-subtitle {
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
letter-spacing: 0.6px;
|
||||
margin-bottom: 6px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
form {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.field {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.field-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 10px;
|
||||
letter-spacing: 1.5px;
|
||||
text-transform: uppercase;
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
}
|
||||
|
||||
.dialog-input {
|
||||
width: 100%;
|
||||
background: rgba(4, 4, 20, 0.62);
|
||||
border: 1px solid var(--bb-border);
|
||||
color: var(--bb-title);
|
||||
border-radius: 2px;
|
||||
padding: 0.6rem 0.7rem;
|
||||
font-family: 'Space Mono', monospace;
|
||||
background: rgba(8, 5, 20, 0.6);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 12px 14px;
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.3px;
|
||||
transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
|
||||
}
|
||||
|
||||
.dialog-input::placeholder {
|
||||
color: rgba(255, 255, 255, 0.28);
|
||||
}
|
||||
|
||||
.dialog-input:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px rgba(0, 213, 255, 0.25);
|
||||
}
|
||||
|
||||
.dialog-textarea {
|
||||
min-height: 120px;
|
||||
resize: vertical;
|
||||
border-color: var(--auth-neon);
|
||||
background: rgba(20, 6, 26, 0.7);
|
||||
box-shadow: 0 0 0 3px rgba(255, 69, 200, 0.15), 0 0 18px rgba(255, 69, 200, 0.18);
|
||||
}
|
||||
|
||||
.text-danger {
|
||||
color: #dc3545;
|
||||
font-size: 0.875rem;
|
||||
color: #ff6ea0;
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.error-banner {
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 69, 110, 0.08);
|
||||
border: 1px solid rgba(255, 69, 110, 0.35);
|
||||
color: #ff9bb4;
|
||||
animation: shake 0.35s ease-out;
|
||||
}
|
||||
|
||||
.dialog-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 6px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
border-radius: 10px;
|
||||
padding: 12px 14px;
|
||||
font-family: var(--auth-sans);
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.4px;
|
||||
cursor: pointer;
|
||||
transition: all 0.18s ease;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn-ghost {
|
||||
background: transparent;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
.btn-ghost:hover:not(:disabled) {
|
||||
color: #fff;
|
||||
border-color: rgba(255, 255, 255, 0.25);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--auth-neon);
|
||||
border: 1px solid var(--auth-neon);
|
||||
color: #1a0210;
|
||||
box-shadow: 0 0 18px rgba(255, 69, 200, 0.45);
|
||||
}
|
||||
|
||||
.btn-primary:hover:not(:disabled) {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 0 26px rgba(255, 69, 200, 0.7);
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.alt-line {
|
||||
margin-top: 4px;
|
||||
text-align: center;
|
||||
font-family: var(--auth-mono);
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.alt-line a {
|
||||
color: var(--auth-neon);
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.alt-line a:hover {
|
||||
text-shadow: 0 0 8px var(--auth-neon-soft);
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 2px solid rgba(26, 2, 16, 0.35);
|
||||
border-top-color: #1a0210;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.7s linear infinite;
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
@@ -66,3 +306,28 @@
|
||||
white-space: nowrap !important;
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
@keyframes scanline {
|
||||
0% { transform: translateY(-100%); }
|
||||
100% { transform: translateY(300%); }
|
||||
}
|
||||
@keyframes pulse-glow {
|
||||
0%, 100% { opacity: 0.85; }
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
@keyframes dialog-in {
|
||||
from { opacity: 0; transform: translateY(8px) scale(0.96); }
|
||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||
}
|
||||
@keyframes backdrop-in {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
@keyframes shake {
|
||||
0%, 100% { transform: translateX(0); }
|
||||
20%, 60% { transform: translateX(-4px); }
|
||||
40%, 80% { transform: translateX(4px); }
|
||||
}
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
@@ -1,40 +1,65 @@
|
||||
<div class="dialog-overlay" (click)="closeDialog()">
|
||||
<div class="dialog-card" (click)="$event.stopPropagation()">
|
||||
<div class="dialog-title">CREATE ACCOUNT</div>
|
||||
<div class="dialog-head">
|
||||
<span class="brand-tag">NowChess // Register</span>
|
||||
<button type="button" class="close-btn" (click)="closeDialog()" aria-label="Close">×</button>
|
||||
</div>
|
||||
|
||||
<h2 class="dialog-title">Create account</h2>
|
||||
<div class="dialog-subtitle">Join the board and start playing</div>
|
||||
|
||||
<form [formGroup]="registerForm" (ngSubmit)="onSubmit()">
|
||||
<input id="username" type="text" class="dialog-input" formControlName="username" placeholder="Username" />
|
||||
@if (registerForm.get('username')?.invalid && registerForm.get('username')?.touched) {
|
||||
<small class="text-danger">Username must be at least 3 characters</small>
|
||||
}
|
||||
<div class="field">
|
||||
<label for="username" class="field-label">Username</label>
|
||||
<input id="username" type="text" class="dialog-input" formControlName="username"
|
||||
placeholder="your_handle" autocomplete="username" />
|
||||
@if (registerForm.get('username')?.invalid && registerForm.get('username')?.touched) {
|
||||
<small class="text-danger">Username must be at least 3 characters</small>
|
||||
}
|
||||
</div>
|
||||
|
||||
<input id="email" type="email" class="dialog-input" formControlName="email" placeholder="Email" />
|
||||
@if (registerForm.get('email')?.invalid && registerForm.get('email')?.touched) {
|
||||
<small class="text-danger">Please enter a valid email</small>
|
||||
}
|
||||
<div class="field">
|
||||
<label for="email" class="field-label">Email</label>
|
||||
<input id="email" type="email" class="dialog-input" formControlName="email"
|
||||
placeholder="you@domain.com" autocomplete="email" />
|
||||
@if (registerForm.get('email')?.invalid && registerForm.get('email')?.touched) {
|
||||
<small class="text-danger">Please enter a valid email</small>
|
||||
}
|
||||
</div>
|
||||
|
||||
<input id="password" type="password" class="dialog-input" formControlName="password" placeholder="Password" />
|
||||
@if (registerForm.get('password')?.invalid && registerForm.get('password')?.touched) {
|
||||
<small class="text-danger">Password must be at least 6 characters</small>
|
||||
}
|
||||
|
||||
<input id="confirmPassword" type="password" class="dialog-input" formControlName="confirmPassword"
|
||||
placeholder="Confirm Password" />
|
||||
<div class="field-row">
|
||||
<div class="field">
|
||||
<label for="password" class="field-label">Password</label>
|
||||
<input id="password" type="password" class="dialog-input" formControlName="password"
|
||||
placeholder="••••••••" autocomplete="new-password" />
|
||||
@if (registerForm.get('password')?.invalid && registerForm.get('password')?.touched) {
|
||||
<small class="text-danger">Min 6 characters</small>
|
||||
}
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="confirmPassword" class="field-label">Confirm</label>
|
||||
<input id="confirmPassword" type="password" class="dialog-input" formControlName="confirmPassword"
|
||||
placeholder="••••••••" autocomplete="new-password" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (errorMessage) {
|
||||
<div class="error-banner">{{ errorMessage }}</div>
|
||||
<div class="error-banner">{{ errorMessage }}</div>
|
||||
}
|
||||
|
||||
<div class="dialog-actions">
|
||||
<button type="button" class="app-btn" (click)="openLogin()">Already have an account?</button>
|
||||
<button type="button" class="app-btn" (click)="closeDialog()">Cancel</button>
|
||||
<button type="submit" class="app-btn" [disabled]="isLoading || registerForm.invalid">
|
||||
<button type="button" class="btn btn-ghost" (click)="closeDialog()">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary" [disabled]="isLoading || registerForm.invalid">
|
||||
@if (isLoading) {
|
||||
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
|
||||
<span class="spinner" aria-hidden="true"></span>
|
||||
}
|
||||
Register
|
||||
{{ isLoading ? 'Creating…' : 'Create account' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="alt-line">
|
||||
Already have an account?<a (click)="openLogin()">Sign in</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
</svg>
|
||||
Watch
|
||||
</button>
|
||||
<button type="button" class="nc-link">Leaderboard</button>
|
||||
<button type="button" class="nc-link" (click)="goToTournaments()">Tournaments</button>
|
||||
<button type="button" class="nc-link" (click)="goToBots()">Bots</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ export class ToolbarComponent implements OnInit {
|
||||
private readonly router = inject(Router);
|
||||
|
||||
private pollHandle: ReturnType<typeof setInterval> | null = null;
|
||||
private readonly navigatedChallengeIds = new Set<string>();
|
||||
|
||||
currentUser: CurrentUser | null = null;
|
||||
showLoginDialog = false;
|
||||
@@ -55,6 +56,7 @@ export class ToolbarComponent implements OnInit {
|
||||
} else {
|
||||
this.challengeWs.disconnect();
|
||||
this.stopPolling();
|
||||
this.navigatedChallengeIds.clear();
|
||||
this.challengeEventService.clear();
|
||||
}
|
||||
});
|
||||
@@ -76,8 +78,8 @@ export class ToolbarComponent implements OnInit {
|
||||
}
|
||||
|
||||
private startPolling(): void {
|
||||
this.fetchIncoming();
|
||||
this.pollHandle = setInterval(() => this.fetchIncoming(), 5000);
|
||||
this.fetchChallenges();
|
||||
this.pollHandle = setInterval(() => this.fetchChallenges(), 10_000);
|
||||
}
|
||||
|
||||
private stopPolling(): void {
|
||||
@@ -87,11 +89,21 @@ export class ToolbarComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
private fetchIncoming(): void {
|
||||
private fetchChallenges(): void {
|
||||
this.challengeService.listChallenges().subscribe({
|
||||
next: response => {
|
||||
const incoming = response.in ?? response.incoming ?? [];
|
||||
this.challengeEventService.setIncomingChallenges(incoming);
|
||||
|
||||
const outgoing = response.out ?? response.outgoing ?? [];
|
||||
for (const c of outgoing) {
|
||||
if (c.status === 'accepted' && c.gameId && !this.navigatedChallengeIds.has(c.id)) {
|
||||
this.navigatedChallengeIds.add(c.id);
|
||||
if (!this.router.url.includes(`/game/${c.gameId}`)) {
|
||||
void this.router.navigate(['/game', c.gameId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -167,12 +179,24 @@ export class ToolbarComponent implements OnInit {
|
||||
void this.router.navigate(['/games']);
|
||||
}
|
||||
|
||||
goToTournaments(): void {
|
||||
this.profileOpen = false;
|
||||
this.notifOpen = false;
|
||||
void this.router.navigate(['/tournaments']);
|
||||
}
|
||||
|
||||
goToChallenges(): void {
|
||||
this.profileOpen = false;
|
||||
this.notifOpen = false;
|
||||
void this.router.navigate(['/challenges']);
|
||||
}
|
||||
|
||||
goToBots(): void {
|
||||
this.profileOpen = false;
|
||||
this.notifOpen = false;
|
||||
void this.router.navigate(['/bots']);
|
||||
}
|
||||
|
||||
onLoginSuccess(): void {
|
||||
this.closeLoginDialog();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user