feat(ui): single-word rule indicators + auto-match select redesign
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 46s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m9s
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 46s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m9s
Surface the per-game "single word" rule to the client and refine the random-opponent New Game screen. - Wire: thread multiple_words_per_turn into the GameView and Invitation FlatBuffers tables (Go + TS regenerated), through pkg/wire builders and both the backend push-event and gateway REST paths. - In-game indicators (single-word games only): a small 1 in the status bar's score-preview slot (yields to the live preview) and a centred "One word per turn" label in the history-drawer header. Standard games show neither. - Invitation card gains a "One word per turn" line for single-word invitations. - Auto-match redesign: variant plaques are mutually-exclusive selects (highlight on tap, no longer enqueue); a lone offered variant is pre-selected; a bottom "Start game" button (disabled until a variant is chosen) confirms. The rule toggle appears once a Russian variant is selected. - Tests: e2e for the new auto flow and the in-game indicator (mock g3 is a single-word game); mock/data + fixtures carry the new field. Docs: UI_DESIGN.
This commit is contained in:
@@ -238,6 +238,7 @@ function decodeGameView(g: fb.GameView): GameView {
|
||||
players: g.players(),
|
||||
toMove: g.toMove(),
|
||||
turnTimeoutSecs: g.turnTimeoutSecs(),
|
||||
multipleWordsPerTurn: g.multipleWordsPerTurn(),
|
||||
moveCount: g.moveCount(),
|
||||
endReason: s(g.endReason()),
|
||||
lastActivityUnix: Number(g.lastActivityUnix()),
|
||||
@@ -686,6 +687,7 @@ function decodeInvitationTable(i: fb.Invitation): Invitation {
|
||||
turnTimeoutSecs: i.turnTimeoutSecs(),
|
||||
hintsAllowed: i.hintsAllowed(),
|
||||
hintsPerPlayer: i.hintsPerPlayer(),
|
||||
multipleWordsPerTurn: i.multipleWordsPerTurn(),
|
||||
dropoutTiles: s(i.dropoutTiles()),
|
||||
status: s(i.status()),
|
||||
gameId: s(i.gameId()),
|
||||
@@ -721,6 +723,7 @@ function emptyGame(): GameView {
|
||||
players: 0,
|
||||
toMove: 0,
|
||||
turnTimeoutSecs: 0,
|
||||
multipleWordsPerTurn: true,
|
||||
moveCount: 0,
|
||||
endReason: '',
|
||||
lastActivityUnix: 0,
|
||||
|
||||
@@ -12,6 +12,7 @@ function gameView(moveCount: number, over = false): GameView {
|
||||
players: 2,
|
||||
toMove: 1,
|
||||
turnTimeoutSecs: 300,
|
||||
multipleWordsPerTurn: true,
|
||||
moveCount,
|
||||
endReason: over ? 'standard' : '',
|
||||
lastActivityUnix: 0,
|
||||
|
||||
@@ -69,6 +69,7 @@ export const en = {
|
||||
'game.dropGame': 'Drop game',
|
||||
'game.previewWords': '{words}: {n}',
|
||||
'game.previewIllegal': 'Not a legal move',
|
||||
'game.oneWordRule': 'One word per turn',
|
||||
'game.chooseBlank': 'Choose a letter for the blank',
|
||||
'game.exchangeTitle': 'Select tiles to exchange',
|
||||
'game.exchangeConfirm': 'Exchange {n}',
|
||||
@@ -233,6 +234,7 @@ export const en = {
|
||||
'new.moveTime': 'Move time',
|
||||
'new.hintsPerPlayer': 'Hints per player',
|
||||
'new.multipleWordsPerTurn': 'Multiple words per turn',
|
||||
'new.start': 'Start game',
|
||||
'new.invited': 'Invitation sent.',
|
||||
'new.noFriends': 'Add friends first to invite them.',
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ export const ru: Record<MessageKey, string> = {
|
||||
'game.dropGame': 'Покинуть игру',
|
||||
'game.previewWords': '{words}: {n}',
|
||||
'game.previewIllegal': 'Недопустимый ход',
|
||||
'game.oneWordRule': 'Одно слово за ход',
|
||||
'game.chooseBlank': 'Выберите букву для бланка',
|
||||
'game.exchangeTitle': 'Выберите фишки для обмена',
|
||||
'game.exchangeConfirm': 'Обменять {n}',
|
||||
@@ -234,6 +235,7 @@ export const ru: Record<MessageKey, string> = {
|
||||
'new.moveTime': 'Время на ход',
|
||||
'new.hintsPerPlayer': 'Подсказок на игрока',
|
||||
'new.multipleWordsPerTurn': 'Несколько слов за ход',
|
||||
'new.start': 'Начать игру',
|
||||
'new.invited': 'Приглашение отправлено.',
|
||||
'new.noFriends': 'Сначала добавьте друзей, чтобы пригласить их.',
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ function game(id: string, status: GameView['status'], toMove: number, lastActivi
|
||||
players: 2,
|
||||
toMove,
|
||||
turnTimeoutSecs: 0,
|
||||
multipleWordsPerTurn: true,
|
||||
moveCount: 0,
|
||||
endReason: '',
|
||||
lastActivityUnix,
|
||||
|
||||
@@ -142,7 +142,7 @@ export class MockGateway implements GatewayClient {
|
||||
}
|
||||
|
||||
// --- lobby ---
|
||||
async lobbyEnqueue(variant: Variant, _multipleWords: boolean): Promise<MatchResult> {
|
||||
async lobbyEnqueue(variant: Variant, multipleWords: boolean): Promise<MatchResult> {
|
||||
// Simulate a 10s-style robot substitution, sped up: match found shortly.
|
||||
const id = crypto.randomUUID();
|
||||
const g: MockGame = {
|
||||
@@ -154,6 +154,7 @@ export class MockGateway implements GatewayClient {
|
||||
players: 2,
|
||||
toMove: 0,
|
||||
turnTimeoutSecs: 86400,
|
||||
multipleWordsPerTurn: multipleWords,
|
||||
moveCount: 0,
|
||||
endReason: '',
|
||||
lastActivityUnix: Math.floor(Date.now() / 1000),
|
||||
@@ -442,6 +443,7 @@ export class MockGateway implements GatewayClient {
|
||||
turnTimeoutSecs: settings.turnTimeoutSecs,
|
||||
hintsAllowed: settings.hintsAllowed,
|
||||
hintsPerPlayer: settings.hintsPerPlayer,
|
||||
multipleWordsPerTurn: settings.multipleWordsPerTurn,
|
||||
dropoutTiles: settings.dropoutTiles,
|
||||
status: 'pending',
|
||||
gameId: '',
|
||||
|
||||
@@ -61,6 +61,7 @@ export function mockInvitations(): Invitation[] {
|
||||
turnTimeoutSecs: 86400,
|
||||
hintsAllowed: true,
|
||||
hintsPerPlayer: 1,
|
||||
multipleWordsPerTurn: true,
|
||||
dropoutTiles: 'remove',
|
||||
status: 'pending',
|
||||
gameId: '',
|
||||
@@ -141,6 +142,7 @@ function activeGame(): MockGame {
|
||||
players: 2,
|
||||
toMove: 0,
|
||||
turnTimeoutSecs: 86400,
|
||||
multipleWordsPerTurn: true,
|
||||
moveCount: G1_MOVES.length,
|
||||
endReason: '',
|
||||
lastActivityUnix: Math.floor(Date.now() / 1000) - 7200,
|
||||
@@ -175,6 +177,7 @@ function finishedG2(): MockGame {
|
||||
players: 2,
|
||||
toMove: 0,
|
||||
turnTimeoutSecs: 86400,
|
||||
multipleWordsPerTurn: true,
|
||||
moveCount: 2,
|
||||
endReason: 'normal',
|
||||
lastActivityUnix: Math.floor(Date.now() / 1000) - 86400,
|
||||
@@ -210,6 +213,7 @@ function finishedG3(): MockGame {
|
||||
players: 2,
|
||||
toMove: 0,
|
||||
turnTimeoutSecs: 86400,
|
||||
multipleWordsPerTurn: false,
|
||||
moveCount: 1,
|
||||
endReason: 'resignation',
|
||||
lastActivityUnix: Math.floor(Date.now() / 1000) - 172800,
|
||||
|
||||
@@ -38,6 +38,8 @@ export interface GameView {
|
||||
players: number;
|
||||
toMove: number;
|
||||
turnTimeoutSecs: number;
|
||||
/** true = standard Scrabble; false = the single-word rule (Russian games). */
|
||||
multipleWordsPerTurn: boolean;
|
||||
moveCount: number;
|
||||
endReason: string;
|
||||
/** Lobby sort key: the current turn's start (active) or the finish time (finished), Unix seconds. */
|
||||
@@ -177,6 +179,8 @@ export interface Invitation {
|
||||
turnTimeoutSecs: number;
|
||||
hintsAllowed: boolean;
|
||||
hintsPerPlayer: number;
|
||||
/** true = standard Scrabble; false = the single-word rule (Russian games). */
|
||||
multipleWordsPerTurn: boolean;
|
||||
dropoutTiles: string;
|
||||
status: string;
|
||||
gameId: string;
|
||||
|
||||
@@ -20,6 +20,7 @@ function game(seats: Seat[], status = 'finished', toMove = 0): GameView {
|
||||
players: seats.length,
|
||||
toMove,
|
||||
turnTimeoutSecs: 0,
|
||||
multipleWordsPerTurn: true,
|
||||
moveCount: 0,
|
||||
endReason: '',
|
||||
lastActivityUnix: 0,
|
||||
|
||||
Reference in New Issue
Block a user