feat(ui): per-kind active-game limit lock on the New Game screen
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 12s
CI / integration (pull_request) Successful in 28s
CI / ui (pull_request) Successful in 1m11s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m46s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 12s
CI / integration (pull_request) Successful in 28s
CI / ui (pull_request) Successful in 1m11s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m46s
Carry the caller's per-tier active-game caps and each game's kind on the wire (Profile.game_limits + GameView.kind, additive FBS + gateway transcode + client codec, committed regen). The New Game screen counts the player's active games per kind from the lobby and locks a capped start: an outline button with a lock that opens a funnel modal instead of a game -- a sign-in prompt for a guest, a "finish a current game first" notice for a signed-in account (native Telegram popup, in-app modal elsewhere). The lock lifts via the existing profile refetch after a guest->durable upgrade. Remove the lobby's old at_game_limit New-Game tab disable + notice: the flag (now the random-kind cap) conflicted with the per-kind lock -- it hid the screen where the lock lives and wrongly blocked an unfulfilled kind. The New Game tab is always enabled; the per-kind start lock is the only gate. The at_game_limit wire field stays (unused by the client) for a later cleanup. Tests: client lock logic + codec kind/game_limits roundtrip + gateway transcode encode + native popup builders (unit); a mock e2e for the lock badge and the modal.
This commit is contained in:
@@ -666,11 +666,14 @@ in either direction (the enqueue excludes the caller's `BlockedWith` set);
|
||||
refuses a **guest** outright with **403** (guests cannot use friends — the same guest gate
|
||||
covers friend requests and friend-code redemption). **Accepting** an invitation
|
||||
(`POST /invitations/:id/accept`) is never gated, so friend games are capped only at
|
||||
initiation. The lobby learns the random-kind state from a boolean **`at_game_limit`** on
|
||||
the `games.list` response — already re-fetched on entry and every game event; the client
|
||||
additionally counts the listed games per kind against the per-tier caps it reads in the
|
||||
profile, locking a kind's New-Game entry (a login funnel for a guest, an already-at-limit
|
||||
note for a durable account) when that kind is full.
|
||||
initiation. The client counts its lobby games per kind against the per-tier caps it reads on
|
||||
the profile (`Profile.game_limits`, carrying `GameView.kind`), and locks a capped kind's
|
||||
New-Game start — a 🔒 outline button that opens a prompt instead of a game: a sign-in funnel
|
||||
for a guest, a "finish a current game first" notice for a durable account (native inside
|
||||
Telegram, an in-app modal elsewhere), lifting when the profile is re-fetched after a
|
||||
guest→durable upgrade. The `games.list` `at_game_limit` boolean (now the random-kind cap) is
|
||||
still carried but no longer drives the UI — the per-kind start lock superseded the old
|
||||
New-Game-tab disable.
|
||||
- **Friends**: two add paths over one `friendships` table. A **one-time
|
||||
code** the to-be-added player issues (a `friend_codes` row: 6-digit numeric,
|
||||
SHA-256-hashed, **12 h** TTL, one live code per issuer, single-use, redeem
|
||||
|
||||
+11
-8
@@ -190,14 +190,17 @@ Mini App, the link only opens the app and the recipient enters the copied code b
|
||||
settings and the game starts once every invitee has accepted — any decline cancels it, and an unanswered invitation
|
||||
expires after seven days.
|
||||
|
||||
**Simultaneous-game cap.** A player may hold at most **10 active quick games** at once —
|
||||
counting both in-progress and still-searching auto-match/AI games, but **not** friend games
|
||||
created by invitation. At the cap the **New Game** button is disabled (greyed) and a plain,
|
||||
low-emphasis line under the lists reads *"You've reached the simultaneous games limit."*; both
|
||||
clear automatically once an active game finishes and the count drops below ten. The cap blocks
|
||||
**starting** any game (a quick game or a friend invitation, which share the New Game entry), but
|
||||
**accepting an incoming invitation is never blocked** — so friend games are capped from the other
|
||||
end (you cannot initiate one while at the cap) while you can always join a game you are invited to.
|
||||
**Active-game caps (per kind).** A player's simultaneous unfinished games are capped **per kind** —
|
||||
against the AI, in a random match, and by friend invitation — with separate limits for a **guest**
|
||||
and a signed-in (durable) account, tuned by the operator without a release. A **guest** may hold **1**
|
||||
game against the AI and **1** random match at once and cannot start friend games at all; a signed-in
|
||||
account holds up to **10** of each kind. Only in-progress and still-searching games count; a finished
|
||||
game frees its slot, and games already in progress are never interrupted. On the **New Game** screen a
|
||||
start whose kind is at its cap shows a **🔒** and, when tapped, opens a short prompt instead of a game:
|
||||
a **guest** is invited to sign in or create an account (to play several games at once), a signed-in
|
||||
player is told to finish a current game first. **Accepting an incoming invitation is never blocked** —
|
||||
friend games are capped only when you start one. The server enforces every cap regardless of the
|
||||
client, and refuses a guest's friend request, friend code or invitation outright.
|
||||
|
||||
### Playing a game
|
||||
Place tiles, pass, exchange, or resign. Pass and exchange share one control —
|
||||
|
||||
+12
-9
@@ -197,15 +197,18 @@ e-mail) либо ввод фразы. Активные игры форфейтя
|
||||
выбирает настройки, и партия стартует, когда приняли все приглашённые — любой отказ отменяет приглашение, а без
|
||||
ответа приглашение протухает через семь дней.
|
||||
|
||||
**Лимит одновременных партий.** Игрок может держать одновременно не более **10 активных
|
||||
быстрых партий** — считаются и идущие, и ещё ищущие соперника авто-подбор/AI-партии, но **не**
|
||||
игры с друзьями, созданные приглашением. На лимите кнопка **«Новая игра»** становится неактивной
|
||||
(серой), а под списками появляется ненавязчивая строка *«Вы достигли лимита одновременных
|
||||
партий»*; и кнопка, и надпись снимаются автоматически, как только активная партия завершается и
|
||||
счётчик опускается ниже десяти. Лимит запрещает **создавать** любую партию (быструю или
|
||||
приглашение в игру с друзьями — у них общий вход «Новая игра»), но **принимать входящее
|
||||
приглашение никогда не запрещено** — так игры с друзьями ограничиваются «с другого конца» (на
|
||||
лимите их нельзя инициировать), а присоединиться к партии по приглашению можно всегда.
|
||||
**Лимит одновременных партий (по видам).** Число одновременных незавершённых партий игрока
|
||||
ограничено **по видам** — против AI, в случайном подборе и по приглашению друзей — с раздельными
|
||||
лимитами для **гостя** и для вошедшего (постоянного) аккаунта; оператор настраивает их без релиза.
|
||||
**Гость** может держать **1** партию против AI и **1** случайную одновременно и вовсе не может
|
||||
создавать игры с друзьями; вошедший аккаунт — до **10** каждого вида. Считаются только идущие и ещё
|
||||
ищущие соперника партии; завершённая освобождает слот, а уже идущие партии никогда не прерываются.
|
||||
На экране **«Новая игра»** старт того вида, что достиг лимита, показывает **🔒** и по нажатию
|
||||
открывает короткое сообщение вместо партии: **гостю** предлагают войти или создать учётную запись
|
||||
(чтобы играть несколько партий сразу), вошедшему — сначала завершить текущую. **Принимать входящее
|
||||
приглашение никогда не запрещено** — игры с друзьями ограничиваются только при создании. Сервер
|
||||
применяет все лимиты независимо от клиента и напрямую отклоняет заявку в друзья, код друга или
|
||||
приглашение от гостя.
|
||||
|
||||
### Игровой процесс
|
||||
Выкладывание фишек, пас, обмен или сдача. Пас и обмен — один элемент управления:
|
||||
|
||||
+9
-6
@@ -347,12 +347,15 @@ its entrance (`components/Toast.svelte`, re-keyed on a per-message sequence). An
|
||||
lives ~2 s, drifting up by about the tab-bar height as it fades (a plain fade, no travel, under
|
||||
reduce-motion); an **error** toast dwells longer (~4 s). Either dismisses instantly on tap.
|
||||
|
||||
**Simultaneous-game cap.** When the player is at the active-quick-game cap (`games.list`
|
||||
`at_game_limit`), the lobby's **New Game** tab is **disabled** (greyed via the shared
|
||||
`.tab:disabled` opacity) and a plain, low-emphasis line — muted, centred, no accent — sits
|
||||
under the lists with the localized "limit reached" notice. Both follow the flag carried in the
|
||||
cached lobby snapshot, so they render in their last-known state on entry (the button stays
|
||||
enabled on the first, uncached load) and flip in place when an event refreshes the lobby.
|
||||
**Active-game caps.** A player's simultaneous unfinished games are capped per kind (vs AI / random /
|
||||
friends) against the caller's per-tier limits (`Profile.game_limits`), counted client-side from the
|
||||
lobby games. The lobby's **New Game** tab is **always enabled** — the lock lives on the per-kind
|
||||
start, not the tab. On the **New Game** screen a start whose kind is at its cap renders as an
|
||||
**outline** button with a **🔒** (not the filled accent CTA), so it reads as gated rather than ready;
|
||||
tapped, it opens a short prompt instead of a game — inside Telegram a **native popup**, elsewhere the
|
||||
in-app **Modal**. A **guest** sees a sign-in funnel (Cancel / Sign in → the account screen); a
|
||||
signed-in account at its cap sees a plain "finish a current game first" notice (OK). The lock lifts in
|
||||
place when the profile is re-fetched after a guest→durable upgrade.
|
||||
|
||||
## Social, account & history surfaces
|
||||
|
||||
|
||||
Reference in New Issue
Block a user