From 20e51a3d8df54fda46672da44a392f229643bcac Mon Sep 17 00:00:00 2001 From: you Date: Thu, 19 Mar 2026 22:34:50 +0000 Subject: [PATCH] fix: favorited (claimed) nodes always sort to top of nodes list --- public/index.html | 2 +- public/nodes.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 96273883..c987ec5c 100644 --- a/public/index.html +++ b/public/index.html @@ -81,7 +81,7 @@ - + diff --git a/public/nodes.js b/public/nodes.js index c478b600..b3d7a573 100644 --- a/public/nodes.js +++ b/public/nodes.js @@ -333,7 +333,15 @@ return; } - tbody.innerHTML = nodes.map(n => { + // Favorites always on top + const favs = getFavorites(); + const sorted = [...nodes].sort((a, b) => { + const aFav = favs.includes(a.public_key) ? 0 : 1; + const bFav = favs.includes(b.public_key) ? 0 : 1; + return aFav - bFav; + }); + + tbody.innerHTML = sorted.map(n => { const roleColor = ROLE_COLORS[n.role] || '#6b7280'; return ` ${favStar(n.public_key, 'node-fav')}${n.name || '(unnamed)'}