Fix hash matrix: green=available, blue=1 node, yellow-red=collision

This commit is contained in:
you
2026-03-19 09:02:38 +00:00
parent 8616145c98
commit 7c90a260ca
+5 -5
View File
@@ -787,9 +787,9 @@
const count = nodes.length;
let bg, color;
if (count === 0) {
bg = 'var(--bg-card, #1a1a2e)'; color = 'var(--text-muted)';
bg = '#166534'; color = '#86efac'; // green — no nodes, available
} else if (count === 1) {
bg = '#166534'; color = '#fff'; // green — free, single user
bg = '#1e3a5f'; color = '#93c5fd'; // blue — single user, no collision
} else {
// 2+ nodes: interpolate yellow→red based on count
const t = Math.min((count - 2) / 4, 1); // 2=yellow, 6+=full red
@@ -797,7 +797,7 @@
const g = Math.round(180 * (1 - t));
bg = `rgb(${r},${g},50)`; color = '#fff';
}
const status = count === 0 ? 'unused' : count === 1 ? `1 node: ${nodes[0].name || nodes[0].public_key.slice(0,12)}` : `${count} nodes — COLLISION`;
const status = count === 0 ? 'available' : count === 1 ? `1 node: ${nodes[0].name || nodes[0].public_key.slice(0,12)}` : `${count} nodes — COLLISION`;
html += `<td class="hash-cell${count ? ' hash-active' : ''}" data-hex="${hex}" style="width:${cellSize}px;height:${cellSize}px;text-align:center;background:${bg};color:${color};border:1px solid var(--border);cursor:${count ? 'pointer' : 'default'};font-size:0.85em" title="0x${hex}: ${status}">${hex}</td>`;
}
html += '</tr>';
@@ -805,8 +805,8 @@
html += '</table></div>';
html += `<div id="hashDetail" style="flex:1;min-width:200px;max-width:400px;font-size:0.85em"></div></div>
<div style="margin-top:8px;font-size:0.8em;display:flex;gap:16px;align-items:center">
<span><span style="display:inline-block;width:12px;height:12px;background:var(--bg-card,#1a1a2e);border:1px solid var(--border);vertical-align:middle"></span> Unused</span>
<span><span style="display:inline-block;width:12px;height:12px;background:#166534;border:1px solid var(--border);vertical-align:middle"></span> 1 node (free)</span>
<span><span style="display:inline-block;width:12px;height:12px;background:#166534;border:1px solid var(--border);vertical-align:middle"></span> Available</span>
<span><span style="display:inline-block;width:12px;height:12px;background:#1e3a5f;border:1px solid var(--border);vertical-align:middle"></span> 1 node (no collision)</span>
<span><span style="display:inline-block;width:12px;height:12px;background:rgb(239,180,50);border:1px solid var(--border);vertical-align:middle"></span> 2 nodes</span>
<span><span style="display:inline-block;width:12px;height:12px;background:rgb(239,50,50);border:1px solid var(--border);vertical-align:middle"></span> 3+ nodes (collision)</span>
</div>`;