url deep-link: game id in #/game/<id>, multi-tab + bad-link fallback (v0.3.0)
CI / build + unit + e2e (pull_request) Successful in 1m52s
CI / build + unit + e2e (pull_request) Successful in 1m52s
This commit is contained in:
@@ -62,7 +62,7 @@ history/
|
||||
│ ├── db.ts # SQLite open/save/load
|
||||
│ └── *.test.ts # unit tests (vitest)
|
||||
└── src/
|
||||
├── App.tsx # screen router: home → pick → game; owns game/regions/advisors/busy state
|
||||
├── App.tsx # screen router (home → pick → game) + manual hash router (#/game/<id>); owns game/regions/advisors/busy
|
||||
├── main.tsx # React root + ThemeProvider(dark)
|
||||
├── index.css # Tailwind v4 + dark "command-center" theme
|
||||
├── lib/
|
||||
@@ -104,6 +104,13 @@ history/
|
||||
- **No hardcoded origins.** The client uses same-origin relative paths (`/api/...`, `/sse/...`).
|
||||
In dev, Vite proxies them to :4321; in prod/Traefik they're the same origin. So the app works
|
||||
unchanged behind the proxy — never bake in `http://host:port`.
|
||||
- **Hash-based routing (client-only).** The active game's id lives in the URL fragment: home is
|
||||
`#/` (a bare page with no hash is also home) and an active game is `#/game/<id>`. This is a manual
|
||||
hash sync in `App.tsx` — no react-router, no server route (every non-API GET just serves
|
||||
`index.html`), so it is Traefik/static-safe. A deep link opens that exact game and two tabs can
|
||||
run two different games (each has its own React state + `useSse(game.id)`). The URL hash takes
|
||||
precedence over the localStorage active-game id, which remains the fallback for a bare `/` load;
|
||||
a bad/missing id clears the hash to `#/` and falls back to home.
|
||||
- **Batched round model.** Actions and diplomatic messages are queued in `game.pending` via
|
||||
`POST /action` and `POST /diplomacy` (fast, no LLM call, no turn advance). A single
|
||||
`POST /jump` ("Jump forward") commits the whole pending batch in one LLM turn: `engine.runTurn`
|
||||
|
||||
Reference in New Issue
Block a user