Switch map to sub-national regions (v0.12.0) #26

Merged
kamilkrzywda merged 1 commits from feat/sub-national-map into master 2026-10-12 03:13:22 +02:00
Owner

Part of #16

Switches the map to render the finer sub-national regional dataset (public/regions.geo.json, 2,597 regions) instead of whole countries, so the borders are visible at the ~100–200 km sub-region level.

  • src/components/WorldMap.tsx: choropleth source now regions.geo.json; the regions-fill layer paints each sub-region with its parent country's owning-nation color (all sub-regions of a country share the color), and a thin regions-line layer (0.75 px) draws the internal sub-region borders. Click/hover resolve a sub-region's owner via properties.parent → RegionMap (never the sub-region id or the MapLibre-repacked feature.id). A territory-change flash lights up all of a changed country's sub-regions.
  • shared/protocol.ts: kept regionOwner (now a pure ISO_A3 lookup) and added mapFeatureOwner(regions, feature) which reads feature.properties.parent and delegates — the "resolve via parent, never sub-region id" rule lives in one tested shared place.
  • src/App.tsx: a small "Selected: sub-region (PARENT) → Nation" label under the Inspect selector when a map click sets the target.
  • server/map.ts / RegionMap: intentionally unchanged — ownership and the LLM stay at country granularity, so a nation owns whole countries and a whole-country transfer flips all its sub-regions at once. No LLM/prompt change.
  • server/map.test.ts: updated the #6 regression guard + added mapFeatureOwner tests (resolve-via-parent, never sub-region id).
  • AGENTS.md: documented the sub-national choropleth + parent-resolution rule.

No behavior change to the LLM or ownership model — this is the visual/data foundation. PR 3 will let the LLM move individual sub-regions (partial country capture) for true small-scale border shifts and will close #16.

Part 2 of 3 for #16.

Part of #16 Switches the map to render the finer sub-national regional dataset (`public/regions.geo.json`, 2,597 regions) instead of whole countries, so the borders are visible at the ~100–200 km sub-region level. - **`src/components/WorldMap.tsx`:** choropleth source now `regions.geo.json`; the `regions-fill` layer paints each sub-region with its **parent country's owning-nation color** (all sub-regions of a country share the color), and a thin `regions-line` layer (0.75 px) draws the internal sub-region borders. Click/hover resolve a sub-region's owner via `properties.parent` → `RegionMap` (never the sub-region id or the MapLibre-repacked `feature.id`). A territory-change flash lights up all of a changed country's sub-regions. - **`shared/protocol.ts`:** kept `regionOwner` (now a pure ISO_A3 lookup) and added `mapFeatureOwner(regions, feature)` which reads `feature.properties.parent` and delegates — the "resolve via parent, never sub-region id" rule lives in one tested shared place. - **`src/App.tsx`:** a small "Selected: *sub-region* (*PARENT*) → *Nation*" label under the Inspect selector when a map click sets the target. - **`server/map.ts` / `RegionMap`:** intentionally **unchanged** — ownership and the LLM stay at **country** granularity, so a nation owns whole countries and a whole-country transfer flips all its sub-regions at once. No LLM/prompt change. - **`server/map.test.ts`:** updated the #6 regression guard + added `mapFeatureOwner` tests (resolve-via-parent, never sub-region id). - **`AGENTS.md`:** documented the sub-national choropleth + parent-resolution rule. **No behavior change to the LLM or ownership model** — this is the visual/data foundation. PR 3 will let the LLM move *individual* sub-regions (partial country capture) for true small-scale border shifts and will close #16. Part 2 of 3 for #16.
kamilkrzywda added 1 commit 2026-10-12 03:11:14 +02:00
Switch map to sub-national regions (v0.12.0)
CI / build + unit + e2e (pull_request) Successful in 1m18s
06cdbf3d81
Part of #16
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-10-12 03:13:21 +02:00
kamilkrzywda merged commit 0ebdb36daa into master 2026-10-12 03:13:22 +02:00
kamilkrzywda deleted branch feat/sub-national-map 2026-10-12 03:13:23 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/History#26