Dashboard level ladder: show POL upgrade cost under each level (live from contract, USD in tooltip)
This commit is contained in:
+9
-1
@@ -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'){
|
||||
|
||||
Reference in New Issue
Block a user