From e0ca9900d3f846463b2b9ebaa24e733a1cd935b3 Mon Sep 17 00:00:00 2001 From: pablorevilla-meshtastic Date: Fri, 13 Feb 2026 20:18:04 -0800 Subject: [PATCH] fix map error --- meshview/templates/map.html | 65 +++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/meshview/templates/map.html b/meshview/templates/map.html index f9832af..47cd56d 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -210,6 +210,44 @@ function hashToColor(str){ return c; } +function labelFor(key, fallback){ + return mapTranslations[key] || fallback; +} + +function buildNodePopup(node){ + const labels = { + channel: labelFor("channel_label", "Channel"), + model: labelFor("model_label", "Model"), + role: labelFor("role_label", "Role"), + mqtt: labelFor("mqtt_gateway", "MQTT Gateway"), + lastSeen: labelFor("last_seen", "Last Seen"), + firmware: labelFor("firmware", "Firmware"), + yes: mapTranslations.yes || "Yes", + no: mapTranslations.no || "No" + }; + + return ` + ${node.long_name} (${node.short_name})
+ + ${labels.channel} ${node.channel}
+ ${labels.model} ${node.hw_model}
+ ${labels.role} ${node.role}
+ ${labels.mqtt} ${node.is_mqtt_gateway ? labels.yes : labels.no}
+ + ${ + node.last_seen_us + ? `${labels.lastSeen} ${timeAgoFromUs(node.last_seen_us)}
` + : "" + } + + ${ + node.firmware + ? `${labels.firmware} ${node.firmware}
` + : "" + } + `; +} + function hashToUnit(str){ let h = 2166136261; for(let i=0;i${node.long_name} (${node.short_name})
- - ${node.channel}
- ${node.hw_model}
- ${node.role}
- ${ - node.is_mqtt_gateway ? (mapTranslations.yes || "Yes") : (mapTranslations.no || "No") - }
- - ${ - node.last_seen_us - ? ` ${timeAgoFromUs(node.last_seen_us)}
` - : "" - } - - ${ - node.firmware - ? ` ${node.firmware}
` - : "" - } - `; - + marker.bindPopup(buildNodePopup(node)); marker.on('click', () => { onNodeClick(node); - marker.bindPopup(popup).openPopup(); + marker.setPopupContent(buildNodePopup(node)); + marker.openPopup(); }); });