Remove redundant color-blind controls from Acquire
This commit is contained in:
parent
daca2da620
commit
07f046374a
11 changed files with 26 additions and 74 deletions
|
|
@ -32,7 +32,7 @@ pnpm dev
|
|||
Open http://localhost:5173. The test page runs the engine in the browser and shows the viewer
|
||||
as each player sees it. With hot seat on, it switches to whoever must act, so one person can
|
||||
play every seat. The toolbar plays random moves, jumps to the next merger, and switches
|
||||
player, theme, language and colour-blind mode.
|
||||
player, theme and language.
|
||||
|
||||
URL parameters: `players=2..6`, `seed=...`, `publicHoldings=1`, `teamPlay=1`, `autoEnd=1`,
|
||||
`endSize=31`, `twoPlayerMode=fourHands`, `theme=light|dark`, `locale=de`, `moves=50` (random
|
||||
|
|
|
|||
|
|
@ -35,14 +35,7 @@
|
|||
},
|
||||
"entryPoint": "dist/wrapper.js"
|
||||
},
|
||||
"preferences": [
|
||||
{
|
||||
"name": "colorBlind",
|
||||
"label": "Color-blind mode",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
}
|
||||
],
|
||||
"preferences": [],
|
||||
"options": [
|
||||
{
|
||||
"name": "publicHoldings",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Acquire private beta — 22 October 2026
|
||||
|
||||
Private BGS registration: `acquire`, version `1`. Engine `0.0.1`, viewer `0.0.6`.
|
||||
Private BGS registration: `acquire`, version `1`. Engine `0.0.1`, viewer `0.0.7`.
|
||||
Source: <https://github.com/boardgamers/mergers-game>. Keep `public: false`.
|
||||
|
||||
## Validation
|
||||
|
|
@ -12,8 +12,8 @@ Source: <https://github.com/boardgamers/mergers-game>. Keep `public: false`.
|
|||
viewer coverage, preferences, avatars and theme handlers. Protocol `0.10.0` is the
|
||||
latest published npm version checked for this release.
|
||||
- `pnpm test:browser` loads the compiled IIFE and CSS. It covers 68 combinations
|
||||
of locale and viewport (1280, 844, 390 and 320 pixels), Persian RTL, color-blind
|
||||
symbols, chat permissions/sending, analysis chat suppression, every six-player
|
||||
of locale and viewport (1280, 844, 390 and 320 pixels), Persian RTL, chain letters,
|
||||
chat permissions/sending, analysis chat suppression, every six-player
|
||||
and four-hands seat plus spectators, replay/live navigation and real tile moves.
|
||||
- All three tutorials run through normal controls on desktop and phone. Checks
|
||||
cover saved progress, reload, step retry, rejected unrelated actions, French and
|
||||
|
|
@ -41,7 +41,8 @@ Source: <https://github.com/boardgamers/mergers-game>. Keep `public: false`.
|
|||
- Contain wide player/chain tables on narrow screens, without widening the page.
|
||||
- Keep both stock-purchase buttons visible on narrow phones, including languages
|
||||
with longer table headings.
|
||||
- Supply default player symbols in color-blind mode when BGS sends no assignments.
|
||||
- Remove the redundant color-blind toggle and player symbols. Names and chain letters identify
|
||||
everything without relying on color; BGS supporter colors remain supported.
|
||||
- Translate shared chat permissions, unread counts and dates in all 17 locales.
|
||||
- Add three interactive tutorials: founding, mergers and scoring. Lesson text and
|
||||
controls are translated in all 17 locales; progress is stored locally.
|
||||
|
|
@ -52,7 +53,7 @@ Source: <https://github.com/boardgamers/mergers-game>. Keep `public: false`.
|
|||
- Split the game description into two paragraphs.
|
||||
- Remove outer iframe margins and paint the full document with the game theme. Let the board
|
||||
fill its desktop column, keep chat open, and use consistent player colors in the table and chat.
|
||||
- Use chain letters in both color modes; reserve extra symbols for players.
|
||||
- Keep chain letters visible for everyone in both themes.
|
||||
- Explain tile adjacency, chain price tiers (no special abilities), price bands,
|
||||
majority/minority bonuses and ties, safe chains, and final payouts alongside
|
||||
the tutorial actions in all 17 languages. Include an expandable price table
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ In Boardgames, choose + New game and fill in:
|
|||
- **Label:** `Acquire`.
|
||||
- **Players:** `[2, 3, 4, 5, 6]`. Player counts are not a game option.
|
||||
- **Options:** paste the declarations below.
|
||||
- **Preferences:** the shared colour-blind setting:
|
||||
`[{ "name": "colorBlind", "label": "Color-blind mode", "type": "checkbox", "default": false }]`.
|
||||
- **Preferences:** none (`[]`). Chain letters and player names identify everything without relying on color.
|
||||
- **Settings:** none.
|
||||
- **Public:** off.
|
||||
|
||||
|
|
@ -149,7 +148,7 @@ BGS's release checklist, and where this repo stands:
|
|||
each position from the public log. Analysis of ongoing games stays off.
|
||||
- Mobile: phone portrait and landscape, tablet and desktop, both themes, 44px touch targets.
|
||||
- History: no tentative or revisable moves.
|
||||
- Colour-blind mode: declare the `colorBlind` preference (step 2).
|
||||
- Color accessibility: chain letters and player names are always visible; no separate mode is needed.
|
||||
- Languages: the viewer is translated into all 17 BGS locales. The game list's last-move text
|
||||
comes from the English `simple` line that `logSlice` adds to each log entry.
|
||||
- Admin panel content (rules page, pictogram, credits, description, links, screenshots) is in
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "acquire-viewer",
|
||||
"version": "0.0.6",
|
||||
"version": "0.0.7",
|
||||
"private": true,
|
||||
"description": "Browser viewer for Acquire on boardgamers.space",
|
||||
"license": "AGPL-3.0-only",
|
||||
|
|
|
|||
|
|
@ -135,16 +135,10 @@ if (params.has("tutorial")) {
|
|||
sync();
|
||||
});
|
||||
hot.append(hotBox, " Hot seat (view as whoever must act)");
|
||||
// The shared BGS colour-blind preference, sent the way BGS sends preferences.
|
||||
const blind = document.createElement("label");
|
||||
const blindBox = document.createElement("input");
|
||||
blindBox.type = "checkbox";
|
||||
blindBox.checked = params.get("colorBlind") === "1";
|
||||
// Player appearance as BGS sends it: host-resolved colours, symbols and Supporter flags in player
|
||||
// Player appearance as BGS sends it: host-resolved colours and Supporter flags in player
|
||||
// order, plus avatars. Avatars are neutral silhouettes and the badge is served by the dev server,
|
||||
// so the dev page needs no network. BGS requires the badge URL to be http(s).
|
||||
const COLORS = ["#4595d1", "#e68b32", "#8a5cc2", "#3aa35b", "#d14545", "#7a7a7a"];
|
||||
const SYMBOLS = ["circle", "triangle", "square", "diamond", "plus", "star"] as const;
|
||||
const svg = (body: string) =>
|
||||
`data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">${body}</svg>`)}`;
|
||||
const avatars = NAMES.slice(0, players).map(() =>
|
||||
|
|
@ -156,7 +150,6 @@ if (params.has("tutorial")) {
|
|||
players: NAMES.slice(0, players).map((_, i) => ({ pro: i === 1 })),
|
||||
supporterBadge: { url: `${location.origin}/dev-badge.svg`, label: "Supporter" },
|
||||
playerColors: COLORS.slice(0, players),
|
||||
playerSymbols: SYMBOLS.slice(0, players),
|
||||
};
|
||||
// The BGS interface language, sent as preferences.locale.
|
||||
const language = document.createElement("select");
|
||||
|
|
@ -168,11 +161,8 @@ if (params.has("tutorial")) {
|
|||
history.replaceState(null, "", url);
|
||||
sendPreferences();
|
||||
});
|
||||
const sendPreferences = () =>
|
||||
emitter.emit("preferences", { colorBlind: blindBox.checked, bgs: appearance, locale: language.value });
|
||||
const sendPreferences = () => emitter.emit("preferences", { bgs: appearance, locale: language.value });
|
||||
emitter.emit("avatars", avatars);
|
||||
blindBox.addEventListener("change", sendPreferences);
|
||||
blind.append(blindBox, " Colour-blind mode");
|
||||
// Theme as BGS would send it. "Not sent" leaves the viewer on its prefers-color-scheme fallback,
|
||||
// which can only be restored by reloading, as in BGS before the first theme event.
|
||||
const theme = document.createElement("select");
|
||||
|
|
@ -213,7 +203,7 @@ if (params.has("tutorial")) {
|
|||
replayLabel.textContent = "";
|
||||
emitter.emit("replay:end");
|
||||
});
|
||||
bar.append(select, theme, language, hot, blind, replayLabel, status);
|
||||
bar.append(select, theme, language, hot, replayLabel, status);
|
||||
|
||||
// For poking at positions from the browser console: window.acquireDev.load(state).
|
||||
(window as unknown as { acquireDev: unknown }).acquireDev = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { untrack } from "svelte";
|
||||
import { mountChat } from "@boardgamers/protocol/chat/dom";
|
||||
import { PLAYER_SYMBOL_IDS, playerSymbolSvg } from "@boardgamers/protocol/player-symbols";
|
||||
import { playerColor } from "./playerAppearance";
|
||||
import { themeInk } from "./palette";
|
||||
import { useStore } from "./store.svelte";
|
||||
|
|
@ -34,16 +33,6 @@
|
|||
marker.style.background = color;
|
||||
marker.setAttribute("aria-hidden", "true");
|
||||
author.append(marker);
|
||||
const symbol =
|
||||
store.appearance?.playerSymbols?.[player] ??
|
||||
(store.colorBlind ? PLAYER_SYMBOL_IDS[player % PLAYER_SYMBOL_IDS.length] : undefined);
|
||||
if (symbol) {
|
||||
const mark = document.createElement("span");
|
||||
mark.className = "player-symbol";
|
||||
mark.setAttribute("aria-hidden", "true");
|
||||
mark.innerHTML = playerSymbolSvg(symbol);
|
||||
author.append(mark);
|
||||
}
|
||||
}
|
||||
author.append(name);
|
||||
return author;
|
||||
|
|
@ -92,7 +81,6 @@
|
|||
});
|
||||
$effect(() => {
|
||||
void store.appearance;
|
||||
void store.colorBlind;
|
||||
untrack(() => panel?.refresh());
|
||||
});
|
||||
</script>
|
||||
|
|
@ -127,11 +115,6 @@
|
|||
width: 4px;
|
||||
height: 16px;
|
||||
}
|
||||
.chat :global(.player-symbol),
|
||||
.chat :global(.player-symbol svg) {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
.chat :global(.bgs-game-chat input),
|
||||
.chat :global(.bgs-game-chat button:not(:disabled)) {
|
||||
outline: 2.5px solid var(--ink);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<script lang="ts">
|
||||
import { PLAYER_SYMBOL_IDS, playerSymbolSvg } from "@boardgamers/protocol/player-symbols";
|
||||
import type { GameState } from "acquire-engine";
|
||||
import { seatName } from "./format";
|
||||
import { playerColor } from "./playerAppearance";
|
||||
|
|
@ -14,18 +13,12 @@
|
|||
const player = $derived(game.seatOwner[seat] ?? seat);
|
||||
const avatar = $derived(store.avatars[player]);
|
||||
const color = $derived(playerColor(player, store.appearance?.playerColors));
|
||||
const symbol = $derived(
|
||||
store.appearance?.playerSymbols?.[player] ??
|
||||
(store.colorBlind ? PLAYER_SYMBOL_IDS[player % PLAYER_SYMBOL_IDS.length] : undefined)
|
||||
);
|
||||
const badge = $derived(store.appearance?.players[player]?.pro ? store.appearance.supporterBadge : undefined);
|
||||
</script>
|
||||
|
||||
<span class="player">
|
||||
{#if avatar}<img class="avatar" src={avatar} alt="" />{/if}
|
||||
<span class="color" style:background={color} aria-hidden="true"></span>
|
||||
<!-- Catalogued symbol SVGs only: an unknown value renders nothing. -->
|
||||
{#if symbol}<span class="symbol" aria-hidden="true">{@html playerSymbolSvg(symbol)}</span>{/if}
|
||||
<span
|
||||
class="player-name"
|
||||
style:--name-ink-light={themeInk(color, "light")}
|
||||
|
|
@ -51,16 +44,6 @@
|
|||
width: 4px;
|
||||
height: 16px;
|
||||
}
|
||||
.symbol {
|
||||
display: inline-flex;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
color: var(--ink);
|
||||
}
|
||||
.symbol :global(svg) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.badge {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export class ViewerStore {
|
|||
selected = $state<Tile | undefined>();
|
||||
/** Player avatars from BGS, in player order. */
|
||||
avatars = $state<string[]>([]);
|
||||
/** BGS player appearance (colours, symbols, Supporter badges), in player order; cosmetic only. */
|
||||
/** BGS player appearance (colours and Supporter badges), in player order; cosmetic only. */
|
||||
appearance = $state<PlayerAppearance | undefined>();
|
||||
/** BGS interface language (preferences.locale), English until BGS sends one. */
|
||||
locale = $state<Locale>("en");
|
||||
|
|
@ -45,8 +45,6 @@ export class ViewerStore {
|
|||
analysis = $state(false);
|
||||
/** The shared BGS chat, one controller per viewer launch. */
|
||||
readonly chat = new ChatController();
|
||||
/** BGS's shared colour-blind setting: supplies default player symbols. */
|
||||
colorBlind = $state(false);
|
||||
/** The BGS light/dark setting; undefined until BGS sends one (prefers-color-scheme applies). */
|
||||
theme = $state<"light" | "dark" | undefined>();
|
||||
/** True between sending a move and receiving the resulting state, so it cannot be sent twice. */
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ export const viewer = registerViewer<GameState, Move>(
|
|||
store.player = index;
|
||||
},
|
||||
onPreferences(preferences) {
|
||||
store.colorBlind = preferences.colorBlind === true;
|
||||
store.appearance = preferences.bgs;
|
||||
store.analysis = preferences.analysis === true;
|
||||
store.locale = resolveLocale(preferences.locale);
|
||||
|
|
|
|||
|
|
@ -192,10 +192,10 @@ try {
|
|||
"own hand visible while waiting, spectator privacy, board selection/confirmation and replay isolation"
|
||||
);
|
||||
|
||||
await open("players=4&moves=95&theme=light&colorBlind=1");
|
||||
await open("players=4&moves=95&theme=light");
|
||||
assert.equal(await page.locator(".chain .letter").count(), await page.locator(".square.chain").count());
|
||||
assert.equal(await page.locator(".pattern, .patterned").count(), 0);
|
||||
assert.ok((await page.locator(".chat .player-symbol").count()) > 0);
|
||||
assert.equal(await page.locator(".player .symbol, .chat .player-symbol").count(), 0);
|
||||
const authorColors = await page
|
||||
.locator(".chat .player-name")
|
||||
.evaluateAll((names) => names.map((name) => getComputedStyle(name).color));
|
||||
|
|
@ -207,6 +207,7 @@ try {
|
|||
bgs: {
|
||||
players: [{ pro: true }, { pro: true }, { pro: true }, { pro: false }],
|
||||
playerColors: ["#13b7c8", "#111111", "#ffffff", "#3aa35b"],
|
||||
playerSymbols: ["circle", "triangle", "square", "diamond"],
|
||||
},
|
||||
});
|
||||
assert.equal(
|
||||
|
|
@ -214,6 +215,11 @@ try {
|
|||
"Unsent draft",
|
||||
"appearance updates preserve chat drafts"
|
||||
);
|
||||
assert.equal(
|
||||
await page.locator(".player .symbol, .chat .player-symbol").count(),
|
||||
0,
|
||||
"old BGS preferences do not restore redundant symbols"
|
||||
);
|
||||
const customAppearance = await page.evaluate(() => {
|
||||
const names = Object.fromEntries(
|
||||
[...document.querySelectorAll(".players .player-name")].map((name) => [
|
||||
|
|
@ -240,7 +246,7 @@ try {
|
|||
);
|
||||
await page.locator(".chat-composer input").fill("");
|
||||
report.scenarios.push(
|
||||
"chain letters without redundant patterns; player colors/symbols in chat and live appearance updates"
|
||||
"always-visible chain letters, no redundant symbols, player colors and live appearance updates"
|
||||
);
|
||||
|
||||
for (const [width, height] of [
|
||||
|
|
@ -256,11 +262,11 @@ try {
|
|||
assert.equal(await page.locator("main").getAttribute("dir"), locale === "fa" ? "rtl" : "ltr");
|
||||
const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
|
||||
assert.ok(scrollWidth <= width + 1, `${locale} ${width}px: page overflow ${scrollWidth}`);
|
||||
assert.ok((await page.locator(".player .symbol").count()) >= 4, "default color-blind player symbols");
|
||||
assert.equal(await page.locator(".player .symbol").count(), 0);
|
||||
report.layouts.push({ width, height, locale, scrollWidth });
|
||||
}
|
||||
}
|
||||
report.scenarios.push("17 live languages at four viewport sizes, touch controls, RTL and default player symbols");
|
||||
report.scenarios.push("17 live languages at four viewport sizes, touch controls and RTL");
|
||||
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await preferences({ locale: "fr", colorBlind: true });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue