feat(ui): add collapsible layer groups and base-layer previews - #224
Conversation
🦋 Changeset detectedLatest commit: 22442d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
63bd253 to
d2a9689
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds opt-in UI capabilities to the layer switcher: collapsible overlay groups (with visible/total counts) and optional preview thumbnails on split base-layer entries, backed by new config and metadata fields.
Changes:
- Add
collapsibleGroupsoption to the UI layer switcher and implement collapsible overlay groups (split base-layers mode) with visible/total counts. - Add optional
layerSwitcherPreviewUrllayer metadata and plumb it through to switcher entries for base-layer preview thumbnails. - Add new SCSS for the collapsible group toggle/chevron and preview thumbnail elements.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui/src/scss/blocks/_layer-switcher.scss | Adds styles for entry previews and collapsible group toggles/chevrons. |
| packages/ui/src/js/types.ts | Extends layer switcher config state with collapsibleGroups. |
| packages/ui/src/js/index.ts | Sets default collapsibleGroups: false in create options and expands selection behavior comments. |
| packages/ui/src/js/components/switcher/SwitcherEntry.tsx | Adds previewUrl rendering and --with-preview modifier support. |
| packages/ui/src/js/components/layer-switcher/SplitBaseLayerSwitcher.tsx | Implements collapsible overlay groups (split mode) and visible/total counts. |
| packages/ui/src/js/components/layer-switcher/LayerSwitcherEntry.ts | Plumbs layerSwitcherPreviewUrl metadata into SwitcherEntry as previewUrl. |
| packages/ui/src/js/components/layer-switcher/LayerSwitcherContainer.tsx | Exposes collapsibleGroups prop and passes it to the split switcher. |
| packages/ui/src/js/components/layer-switcher/index.ts | Wires collapsibleGroups from config into the container props. |
| packages/core/src/js/lib/map/schema.ts | Adds layerSwitcherPreviewUrl to the layer metadata schema. |
| .changeset/ui-layer-switcher-collapsible-previews.md | Declares version bumps for @mapsight/ui (minor) and @mapsight/core (patch). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (1)
packages/ui/src/js/components/layer-switcher/SplitBaseLayerSwitcher.tsx:88
translate("ui.layer-switcher.expandGroup")/translate("ui.layer-switcher.collapseGroup")are referenced here, but those keys are not present in the current i18n catalogs (e.g.packages/ui/src/js/helpers/i18n/en.tsandde.ts). This will likely render the raw key string in the UI. Add these translations (and any other supported locales) or change the code to use existing keys.
const countLabel = `${visibleCount}/${total}`;
const toggleLabel = collapsed
? translate("ui.layer-switcher.expandGroup")
: translate("ui.layer-switcher.collapseGroup");
Summary
collapsibleGroupson the layer switcher with visible/total counts.