feat(meshcore-map): node-type icons, filter & legend on the source map#3576
Conversation
Extends the issue #3546 node-type work to the per-source MeshCore map, which previously rendered a generic purple "MC" badge for every node. - Markers now show role-based glyphs by advert type (Repeater/Room Server/Sensor/Companion) via getNodeTypeCategory({ advType }); the "MC" badge remains the fallback for standard/unknown nodes. - New shared mapIcons.roleGlyphMarkerSvg() (white circle + role glyph), reused by both the marker and the legend so they can't diverge. - Map Features panel gains a persisted Node Types filter (per-category checkboxes) that hides markers by role; paths/neighbor lines are unaffected, matching the Map Analysis workspace. - MapLegend gains an opt-in showNodeTypes prop rendering a Node Types section; off by default so the Meshtastic maps are unchanged. Verified live on a MeshCore source (70 markers all glyphed; hiding Companion dropped markers 70 -> 51; filter persisted to localStorage; legend section present). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVGxkuD4Fwa2JGVim8ZeVj
38f966f to
459eb4c
Compare
|
Claude finished @Yeraze's task —— View job PR Review: feat(meshcore-map): node-type icons, filter & legend
Overall this is a clean, well-scoped PR. The implementation is consistent with the pattern established in #3546 and the code is easy to follow. A few observations below.
|
| Area | Status |
|---|---|
| Code quality | ✅ Clean, consistent with existing patterns |
| Potential bugs | JSON.parse result not validated as object before use (low risk) |
| Performance | ℹ️ getNodeTypeCategory called twice per visible contact (negligible at current scale) |
| Security | ✅ dangerouslySetInnerHTML input is fully static — no user data involved |
| Test coverage | ✅ Adequate for the new helper; minor edge case missing |
No blocking issues. The PR is ready to merge as-is. The items above are suggestions for future hardening.
Bump version to 4.11.1 across package.json, package-lock.json, desktop/package.json, desktop/src-tauri/tauri.conf.json, and helm/meshmonitor/Chart.yaml. Roll the CHANGELOG [Unreleased] section (device ClientNotification surfacing + firmware 2.8 favorite/ignore cap handling #3548, auto-ack 2x2 matrix #3564, MeshCore node-type map icons #3576) into [4.11.1]. Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Extends the node-type work from #3546 (which shipped only on the
/analysisMap Analysis workspace) to the standard per-source MeshCore map. That map previously drew a generic purple "MC" badge for every node, so operators couldn't distinguish infrastructure (repeaters/room servers) from end-user nodes at a glance, nor focus the map by type. This brings it to parity with the analysis view.Changes
src/utils/mapIcons.ts— newroleGlyphMarkerSvg(category, color, size)helper: the role glyph (roleGlyphInnerSvg) on a white backing circle, as a complete<svg>string. Reused by both the map marker and the legend swatches so the icon a user sees and the legend entry can't diverge. Returns''forstandardso callers keep their default marker.src/components/MeshCore/MeshCoreMap.tsx:getNodeTypeCategory({ advType })and render the role glyph (Repeater = tower, Room Server = server rack, Sensor = broadcast, Companion = person). The "MC" badge stays as the fallback for standard/unknown nodes.localStorage. Hides markers by category; paths/neighbor lines are left untouched, matching how the analysis view's type filter only affects markers.<MapLegend showNodeTypes />).src/components/MapLegend.tsx— opt-inshowNodeTypesprop renders a Node Types legend section (Repeater/Room Server/Sensor/Companion glyph swatches). Off by default, so the Meshtastic maps that share this component are unaffected.src/utils/mapIcons.test.ts— unit tests forroleGlyphMarkerSvg.Reuses the existing, already-tested
getNodeTypeCategory/nodePassesTypeFilterfrom #3546 — no new categorization logic.Issues Resolved
Relates to #3546 (extends it to the MeshCore source map).
Documentation Updates
CHANGELOG.md updated. No feature/API docs affected.
Testing
mapIcons.test.tscases forroleGlyphMarkerSvg(glyph + circle + size;''for standard){"companion":false}to localStorage; the legend showed the Node Types section.🤖 Generated with Claude Code