From b15fd30c4fb378623119353c50bf2a6b468639c9 Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Sat, 6 Jun 2026 14:08:40 +0200 Subject: [PATCH] Stage 17 (contour round 4a): quick fixes - #4 bag label: '{n} in the bag' / 'Bag is empty' (was 'Bag {n}') - #6 allow a single trailing dot in display names (backend + UI regex + tests) - #1 double-tap zooms toward the tapped cell, not the top-left - #8 shuffle fires a short multi-pulse haptic - #11 highlighted/flashing tiles darken their bottom edge too (shadow joins the flash) - #13 toast slides up from the bottom and fades out - #7 hide the logout button (kept wired behind `hidden`) - #16 admin game seats: left-align numeric columns, clarify the 'Hints used' header --- backend/internal/account/profile.go | 7 +++-- backend/internal/account/validate_test.go | 28 ++++++++++--------- .../templates/pages/game_detail.gohtml | 4 +-- ui/src/components/Toast.svelte | 13 ++++++++- ui/src/game/Board.svelte | 9 ++++-- ui/src/game/Game.svelte | 6 ++-- ui/src/lib/i18n.test.ts | 4 +-- ui/src/lib/i18n/en.ts | 3 +- ui/src/lib/i18n/ru.ts | 3 +- ui/src/lib/profileValidation.test.ts | 5 +++- ui/src/lib/profileValidation.ts | 7 +++-- ui/src/screens/Profile.svelte | 4 ++- 12 files changed, 61 insertions(+), 32 deletions(-) diff --git a/backend/internal/account/profile.go b/backend/internal/account/profile.go index daf78b5..8aa7985 100644 --- a/backend/internal/account/profile.go +++ b/backend/internal/account/profile.go @@ -28,9 +28,10 @@ const maxAwayWindow = 12 * time.Hour // displayNameRe enforces the editable display-name format (Stage 8): Unicode letters // joined by single space / "." / "_" separators, where a "." or "_" may be followed -// by a single space. No leading or trailing separator and no two adjacent separators, -// except " ". So "Name_P. Last" is valid, "Name P._Last" is not. -var displayNameRe = regexp.MustCompile(`^\p{L}+(?:(?:[._] ?| )\p{L}+)*$`) +// by a single space. No leading separator and no two adjacent separators (except +// " "); a single trailing "." is allowed (Stage 17), so +// "Name_P. Last" and "Anna B." are valid, "Name P._Last" is not. +var displayNameRe = regexp.MustCompile(`^\p{L}+(?:(?:[._] ?| )\p{L}+)*\.?$`) // ErrInvalidProfile is returned when a profile update carries an unacceptable // field (an unknown language, an invalid timezone, or an over-long display name). diff --git a/backend/internal/account/validate_test.go b/backend/internal/account/validate_test.go index 1e8c978..0bdee79 100644 --- a/backend/internal/account/validate_test.go +++ b/backend/internal/account/validate_test.go @@ -12,19 +12,21 @@ func TestValidateDisplayName(t *testing.T) { want string ok bool }{ - "plain": {"Kaya", "Kaya", true}, - "cyrillic": {"Кая", "Кая", true}, - "dot underscore mix": {"Name_P. Last", "Name_P. Last", true}, - "single dot": {"Mr.Smith", "Mr.Smith", true}, - "dot then space": {"Mr. Smith", "Mr. Smith", true}, - "trim surrounding": {" Kaya ", "Kaya", true}, - "adjacent specials": {"Name P._Last", "", false}, - "two spaces": {"Name Last", "", false}, - "leading special": {"_Name", "", false}, - "trailing special": {"Name.", "", false}, - "digit rejected": {"Name2", "", false}, - "blank": {" ", "", false}, - "too long": {strings.Repeat("a", 33), "", false}, + "plain": {"Kaya", "Kaya", true}, + "cyrillic": {"Кая", "Кая", true}, + "dot underscore mix": {"Name_P. Last", "Name_P. Last", true}, + "single dot": {"Mr.Smith", "Mr.Smith", true}, + "dot then space": {"Mr. Smith", "Mr. Smith", true}, + "trim surrounding": {" Kaya ", "Kaya", true}, + "adjacent specials": {"Name P._Last", "", false}, + "two spaces": {"Name Last", "", false}, + "leading special": {"_Name", "", false}, + "trailing underscore": {"Name_", "", false}, + "trailing dot ok": {"Anna B.", "Anna B.", true}, + "double trailing dot": {"Name..", "", false}, + "digit rejected": {"Name2", "", false}, + "blank": {" ", "", false}, + "too long": {strings.Repeat("a", 33), "", false}, } for name, tc := range cases { t.Run(name, func(t *testing.T) { diff --git a/backend/internal/adminconsole/templates/pages/game_detail.gohtml b/backend/internal/adminconsole/templates/pages/game_detail.gohtml index 313b31f..436fbb2 100644 --- a/backend/internal/adminconsole/templates/pages/game_detail.gohtml +++ b/backend/internal/adminconsole/templates/pages/game_detail.gohtml @@ -17,10 +17,10 @@

Seats

- + {{range .Seats}} - + {{end}}
SeatPlayerScoreHintsWinner
SeatPlayerScoreHints usedWinner
{{.Seat}}{{.DisplayName}}{{.Score}}{{.HintsUsed}}{{if .Winner}}winner{{end}}
{{.Seat}}{{.DisplayName}}{{.Score}}{{.HintsUsed}}{{if .Winner}}winner{{end}}
diff --git a/ui/src/components/Toast.svelte b/ui/src/components/Toast.svelte index 72e8e32..12ee496 100644 --- a/ui/src/components/Toast.svelte +++ b/ui/src/components/Toast.svelte @@ -1,9 +1,20 @@ {#if app.toast} -
{app.toast.text}
+
+ {app.toast.text} +
{/if}