Skip to content

refactor(map): unify layer toggle definitions into shared catalog#943

Merged
koala73 merged 1 commit intomainfrom
refactor/shared-map-layer-catalog
Mar 4, 2026
Merged

refactor(map): unify layer toggle definitions into shared catalog#943
koala73 merged 1 commit intomainfrom
refactor/shared-map-layer-catalog

Conversation

@koala73
Copy link
Owner

@koala73 koala73 commented Mar 3, 2026

Summary

  • Creates src/config/map-layer-definitions.ts — single source of truth for all 37 map layer toggle definitions, with renderer gating (flat/globe), variant ordering, and i18n resolution
  • Replaces DeckGLMap's 72-line 4-branch if/else and GlobeMap's 28-entry hardcoded array with single catalog calls
  • Adds 5 missing happy-variant i18n keys to en.json
  • Globe now respects SITE_VARIANT (tech/finance/happy show variant-relevant layers only)
  • Removes 3 redundant dayNight guards in GlobeMap (catalog handles exclusion via renderers: ['flat'])

Net: -85 lines removed from components, one file to edit when adding layers.

Test plan

  • npx tsc --noEmit passes (0 new errors; 3 pre-existing globe.gl/three type errors unchanged)
  • Flat map: toggle panel unchanged for all 4 variants (same layers, order, labels)
  • Globe: toggle panel matches flat per variant (minus dayNight)
  • Globe on tech/finance/happy subdomains shows only variant-relevant layers
  • dayNight absent from globe toggles, present on flat
  • Toggle check/uncheck propagates to map rendering on both renderers

DeckGLMap and GlobeMap maintained independent hardcoded layer arrays
(~80 inline entries + 28-entry array) that drifted on labels, order,
and variant support. Adding a layer required editing 3+ places.

- Create map-layer-definitions.ts with LAYER_REGISTRY (37 keys),
  VARIANT_LAYER_ORDER (4 variants), renderer gating, and i18n helpers
- Replace DeckGLMap 4-branch if/else (~72 lines) with catalog call
- Replace GlobeMap hardcoded array with catalog call, add i18n header
  and variant awareness (globe now respects SITE_VARIANT)
- Add 5 missing happy-variant i18n keys to en.json
- Remove 3 redundant dayNight guards in GlobeMap (catalog gates via
  renderers: ['flat'])
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vercel
Copy link

vercel bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldmonitor Ready Ready Preview, Comment Mar 3, 2026 8:30pm
worldmonitor-finance Ready Ready Preview, Comment Mar 3, 2026 8:30pm
worldmonitor-happy Ready Ready Preview, Comment Mar 3, 2026 8:30pm
worldmonitor-startup Ready Ready Preview, Comment Mar 3, 2026 8:30pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant