Stage 8 polish: profile validation, finished-game UI, badge + Safari fixes
Tests · Go / test (push) Successful in 7s
Tests · Integration / integration (push) Successful in 11s
Tests · UI / test (push) Successful in 17s

Owner-review follow-up on the Stage 8 branch:
- Friend code is copyable (📋 + toast). The lobby notification badge is fixed —
  it had inherited the hamburger-bar style — into a proper round count dot.
- Safari: min-width:0 on flex text inputs (friend code, profile, chat) so they
  shrink instead of pushing the adjacent button off-screen.
- Profile editing is validated on both the UI and the backend: display-name format
  (letters joined by single space/./_ separators, no leading/trailing/adjacent
  separators, <=32 runes), a UTC-offset timezone picker (account.ResolveZone parses
  ±HH:MM or a legacy IANA name), a 10-minute away grid capped at 12h (wrap-aware),
  and email format; Save is disabled and invalid fields red-bordered until valid.
  Language stays in Settings.
- In a game, an "add to friends" menu item flips to a disabled "request sent"; chat
  send/nudge became ⬆️/🛎️ icon buttons.
- A finished game drops its last-word highlight, hides Check word / Drop game,
  disables zoom, and draws an inert (greyed) footer instead of hiding it.

Tests: account validators (name/away/zone), UI profileValidation, e2e for the
finished-game footer/menu and the copy control. Docs (PLAN, ARCHITECTURE,
FUNCTIONAL +ru, UI_DESIGN) updated for the display-name rule, UTC-offset timezone
and the 12h away window.
This commit is contained in:
Ilia Denisov
2026-06-03 22:12:59 +02:00
parent 2d82c75f0b
commit acbb2d8254
21 changed files with 602 additions and 115 deletions
+48
View File
@@ -0,0 +1,48 @@
import { describe, expect, it } from 'vitest';
import { awayDurationOk, browserOffset, isOffsetZone, validDisplayName, validEmail } from './profileValidation';
describe('validDisplayName', () => {
it.each([
['Kaya', true],
['Кая', true],
['Name_P. Last', true],
['Mr.Smith', true],
['Mr. Smith', true],
[' Kaya ', true],
['Name P._Last', false],
['Name Last', false],
['_Name', false],
['Name.', false],
['Name2', false],
['', false],
['a'.repeat(33), false],
])('%s -> %s', (name, ok) => {
expect(validDisplayName(name)).toBe(ok);
});
});
describe('validEmail', () => {
it('accepts a normal address', () => expect(validEmail('you@example.com')).toBe(true));
it('rejects a missing domain', () => expect(validEmail('you@')).toBe(false));
it('rejects spaces', () => expect(validEmail('a b@x.com')).toBe(false));
});
describe('awayDurationOk', () => {
it.each([
['22:00', '06:00', true],
['00:00', '12:00', true],
['08:00', '21:00', false],
['07:00', '07:00', true],
['20:00', '09:00', false],
])('%s-%s -> %s', (s, e, ok) => expect(awayDurationOk(s, e)).toBe(ok));
});
describe('timezone helpers', () => {
it('detects offset zones', () => {
expect(isOffsetZone('+03:00')).toBe(true);
expect(isOffsetZone('Europe/Moscow')).toBe(false);
});
it('formats the browser offset as ±HH:MM', () => {
expect(browserOffset()).toMatch(/^[+-]\d{2}:\d{2}$/);
});
});