Packet detail byte breakdown uses shared HopDisplay for path hops

Replaces inline conflict rendering with HopDisplay.renderHop() —
consistent regional-only tooltips everywhere.
This commit is contained in:
you
2026-03-22 23:24:02 +00:00
parent 28475722d7
commit 70db798aed
2 changed files with 3 additions and 17 deletions
+1 -1
View File
@@ -86,7 +86,7 @@
<script src="hop-display.js?v=1774221736"></script>
<script src="app.js?v=1774126708"></script>
<script src="home.js?v=1774042199"></script>
<script src="packets.js?v=1774221628"></script>
<script src="packets.js?v=1774221842"></script>
<script src="map.js?v=1774220756" onerror="console.error('Failed to load:', this.src)"></script>
<script src="channels.js?v=1774331200" onerror="console.error('Failed to load:', this.src)"></script>
<script src="nodes.js?v=1774221131" onerror="console.error('Failed to load:', this.src)"></script>
+2 -16
View File
@@ -1336,22 +1336,8 @@
const pathByte = parseInt(buf.slice(2, 4), 16);
const hashSize = (pathByte >> 6) + 1;
for (let i = 0; i < pathHops.length; i++) {
const hopEntry = hopNameCache[pathHops[i]];
const hopName = hopEntry ? (typeof hopEntry === 'string' ? hopEntry : hopEntry.name) : null;
const hopPubkey = hopEntry?.pubkey || pathHops[i];
const conflicts = hopEntry?.conflicts || [];
const distInfo = conflicts.length === 1 && conflicts[0].distKm != null
? ` (${Math.round(conflicts[0].distKm)}km)`
: conflicts.length > 1 && conflicts.find(c => c.distKm != null)
? ` (${Math.round(conflicts.find(c => c.distKm != null).distKm)}km)`
: '';
const conflictInfo = conflicts.length > 1
? ` <span class="hop-warn" title="${conflicts.length} candidates: ${conflicts.map(c => c.name + (c.distKm != null ? ' (' + Math.round(c.distKm) + 'km)' : '') + (c.regional ? '' : ' (global)')).join(', ')}">⚠${conflicts.length}</span>`
: '';
const nameHtml = hopName
? `<a href="#/nodes/${encodeURIComponent(hopPubkey)}" class="hop-link hop-named" data-hop-link="true">${escapeHtml(hopName)}</a>${distInfo}${conflictInfo}`
: '';
const label = hopName ? `Hop ${i}${nameHtml}` : `Hop ${i}`;
const hopHtml = HopDisplay.renderHop(pathHops[i], hopNameCache[pathHops[i]]);
const label = `Hop ${i}${hopHtml}`;
rows += fieldRow(off + i * hashSize, label, pathHops[i], '');
}
off += hashSize * pathHops.length;