container/viewer
2026-09-27 09:20:39 +02:00
..
.vscode Add continuous integration 2021-07-04 00:06:50 +02:00
public Add continuous integration 2021-07-04 00:06:50 +02:00
scripts Add Persian viewer and tutorial translations 2026-09-27 00:53:48 +02:00
src fix: preserve mobile scrolling and cancel reversed loan moves 2026-09-27 09:20:39 +02:00
tests fix: preserve mobile scrolling and cancel reversed loan moves 2026-09-27 09:20:39 +02:00
.browserslistrc Move viewer into own folder 2021-07-03 21:27:24 +02:00
.eslintrc.js Add continuous integration 2021-07-04 00:06:50 +02:00
.gitignore ✨ (viewer) Enable loading game directly from json file 2021-10-14 22:23:29 +02:00
babel.config.js Support translated chat and platform analysis defaults 2026-09-21 20:32:09 +02:00
package.json fix: preserve mobile scrolling and cancel reversed loan moves 2026-09-27 09:20:39 +02:00
README.md feat(viewer): support the shared color-blind preference 2026-09-25 17:38:35 +02:00
tsconfig.json Use shared BGS viewer and chat protocol (#10) 2026-09-13 22:54:10 +02:00
vue.config.js Preserve chat when mobile controls mount and remove redundant drag listeners 2026-09-20 00:10:16 +02:00

Container viewer

From the repository root, install with pnpm install.

Local development

pnpm --dir viewer serve

Add ?chapter=supply-chain to open a tutorial. The other chapter IDs are buildings, selling, bidding, keep-cargo and scoring.

Build and check

pnpm --dir viewer check
pnpm --dir viewer test:tutorial
NODE_OPTIONS=--openssl-legacy-provider pnpm --dir viewer package
pnpm --dir viewer test:browser
pnpm --dir viewer test:tutorial:browser

Browser checks use Playwright Chromium. Set CHROMIUM_EXECUTABLE if using an existing installation. pnpm --dir viewer preview:tutorial serves the built viewer on port 5197.

The Vue 2 type checker needs zod available directly in this workspace to resolve the protocol's schema types through pnpm's symlinks. It is a development dependency.

Tutorials on BGS

Upload the same JS and CSS as the ordinary viewer. The container global exposes both launch and launchTutorial. Chapter metadata is exported as chapterCards from src/tutorial/lessons.ts; enter these IDs, versions, titles and descriptions in the BGS version's Tutorial settings.

Lessons run the real engine locally with deterministic opponents and private player views. The extra lesson controls make drag actions accessible on mobile. Chapter progress survives refresh. Playback controls return to the previous step, replay the current step or go back to the start. No live game or chat messages are sent.

Shared accessibility preference

The viewer follows BGS's boolean colorBlind preference (default false). Its eye icon updates the same shared preference through update:preference. Shapes identify container colours across pieces, factories, value cards, trade controls, tutorials and the journal. Player numbers match ships, boards and island rows. No engine state or colour identifiers are changed.

Register { "name": "colorBlind", "label": "Color-blind mode", "type": "checkbox", "default": false } in the BGS viewer preferences.