Dashboard level ladder: show POL upgrade cost under each level (live from contract, USD in tooltip)

This commit is contained in:
martbost
2026-08-26 05:22:30 -05:00
parent 6cf78a37b7
commit b923bc18bc
2 changed files with 11 additions and 1 deletions
+9 -1
View File
@@ -380,11 +380,19 @@
function renderNextStep(d){
const el=document.getElementById('dNextStep');if(!el)return;
const ns=d.nextStep||{},lvl=d.level||1;
// Per-level upgrade cost: upgradeCosts[tier][k] = POL to go from level k+1
// to k+2, so the cost to REACH level L is index L-2. Scintilla (L1) is the
// entry level, not an upgrade.
const upc=(d.upgradeCosts&&d.upgradeCosts[d.tier===2?2:1])||[];
const ladder=LEVELS.map((nm,i)=>{
const L=i+1;let cls='nlv';
if(L<lvl)cls+=' done';else if(L===lvl)cls+=' you';else if(ns.kind==='upgrade'&&L===ns.nextLevel)cls+=' next';
const tag=L===lvl?'<span class="nlvt">YOU</span>':(ns.kind==='upgrade'&&L===ns.nextLevel?'<span class="nlvt">NEXT</span>':'');
return `<div class="${cls}">${tag}<span class="nlvn">${nm}</span></div>`;
const cost=L===1?null:upc[L-2];
const costTxt=L===1?'entry level':(cost?fmt(cost)+' POL':'');
const usd=(cost&&d.polUsd>0)?' title="≈ $'+Math.round(cost*d.polUsd).toLocaleString()+' to reach '+nm+'"':'';
const costLine=costTxt?`<span class="nlvc"${usd}>${costTxt}</span>`:'';
return `<div class="${cls}">${tag}<span class="nlvn">${nm}</span>${costLine}</div>`;
}).join('');
let head='',body='',badge='';
if(ns.kind==='qualify'){