Skip to content

feat(hex): layer-panel toggle + remove control for hex layers (#318) - #319

Merged
cboettig merged 1 commit into
mainfrom
feat/hex-layer-panel-controls
Jul 14, 2026
Merged

feat(hex): layer-panel toggle + remove control for hex layers (#318)#319
cboettig merged 1 commit into
mainfrom
feat/hex-layer-panel-controls

Conversation

@cboettig

Copy link
Copy Markdown
Member

Closes #318.

Problem

Hex tile layers are added at runtime (add_hex_tile_layeraddHexTileLayer), after generateControls() builds the layer panel once at boot (main.js:99). They land in the same this.layers registry as curated layers, but the panel is never re-rendered, so a hex layer never gets a panel row. The only way to hide or clear one was to ask the LLM.

Change

  • Factor the per-layer row creation out of generateControls() into _createLayerItem(layerId, state), shared by boot rendering and a new _addLayerControl(layerId) that appends a single row incrementally. Incremental append (rather than a full generateControls() re-render) avoids resetting user-toggled group-collapse state.
  • addHexTileLayer() now calls _addLayerControl(). The row carries the same visibility checkbox as every other layer, plus a remove (×) button.
  • The remove button is hex-only: it wires to the existing removeHexTileLayer(). Curated layers have no remove path (only hide), so they get no button — this mirrors the existing backend guard rather than inventing a destroy path for curated layers.
  • removeHexTileLayer() now also removes the panel row.

Notes / scope

  • Covers both asks in the issue: hide/show (existing checkbox, now surfaced) and remove (new button).
  • A general "remove" for curated layers is intentionally out of scope — they have no backing remove method and destroying them is a separate product decision.

Testing

  • New test/map-manager.hex-panel.test.js (jsdom, 5 tests): hex row gets a remove button, curated row doesn't; checkbox reflects visible; _addLayerControl appends once and is idempotent + no-op before panel build; clicking remove tears down the map layer, source, registry entry, and panel row.
  • Full suite green (521 passed).
  • map-manager.js is browser-bound; visual/interaction check on a deployed app still recommended (panel styling, × button placement in light/dark).

Hex tile layers are added at runtime, after generateControls() builds the
layer panel once at boot, so they never got a panel row — the only way to
hide or clear one was to ask the LLM.

- Factor per-layer row creation into _createLayerItem(), shared by
  generateControls() and a new _addLayerControl() that appends a single row
  incrementally (avoids a full re-render, which would reset user-toggled
  group collapse state).
- addHexTileLayer() now calls _addLayerControl(); the row carries the same
  visibility checkbox as other layers plus a remove (×) button.
- The remove button is hex-only: it wires to the existing removeHexTileLayer()
  (curated layers have no remove path, only hide). removeHexTileLayer() now
  also drops the panel row.

Covered by test/map-manager.hex-panel.test.js (jsdom).
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 58.3% 5260 / 9021
🔵 Statements 58.28% 5260 / 9025
🔵 Functions 64.94% 189 / 291
🔵 Branches 83.9% 1173 / 1398
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
app/map-manager.js 50.98% 87.17% 40.42% 51.05% 57-146, 153-157, 163-390, 399-443, 457-479, 520-556, 566-579, 587-600, 664-665, 682-683, 815-824, 852-853, 859-862, 871-881, 887-894, 950-953, 961-965, 968-984, 990-991, 997-1000, 1069-1070, 1090-1092, 1114-1119, 1125-1128, 1138-1156, 1163-1167, 1175-1268, 1275-1315, 1339-1341, 1353-1367, 1413-1418, 1430-1476, 1524-1543, 1546-1561, 1571-1573, 1643-1650, 1684-1685, 1718-1722, 426-460
Generated in workflow #171 for commit 73e36fd by the Vitest Coverage Report Action

cboettig added a commit to boettiger-lab/geo-agent-template that referenced this pull request Jul 14, 2026
Pin all four CDN refs to the head of PR boettiger-lab/geo-agent#319 to
test the hex-layer visibility toggle + remove control before merge.
Return to a release tag when done.
@cboettig
cboettig merged commit b16979f into main Jul 14, 2026
1 check passed
@cboettig
cboettig deleted the feat/hex-layer-panel-controls branch July 14, 2026 18:29
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.

Hex layers: add a clear/toggle control (no LLM round-trip)

1 participant