feat(ui): show billions of dollars and petabits per second

Money shows $1.20B and bandwidth 1.00 Pbps instead of running on in millions and terabits, including the NOC graph and the fibre labels on the map.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lambro-codes 2026-11-04 04:32:16 +01:00
parent b2366ed260
commit 2d88a04584
4 changed files with 28 additions and 3 deletions

View file

@ -20,7 +20,7 @@ const dfLeaseMo=km=>Math.round(400+km*1.0);
const dfBuildCost=km=>Math.round((25000+km*120)*hwMul('build'));
const dfBuildDays=km=>leadDays(Math.round(120+km*0.25)),IRU_DAYS=30;
const ampCount=km=>Math.max(0,Math.floor(km/AMP_EVERY));
const fmtCap=g=>g>=1000?(+(g/1000).toFixed(1))+'T':g+'G';
const fmtCap=g=>g>=999950?(+(g/1e6).toFixed(g>=9.995e6?0:1))+'P':g>=1000?(+(g/1000).toFixed(1))+'T':g+'G';
const WAVECO=['Zay-No Fiber','Loomin’ Technologies','Clown Castle Fiber','Bolt Technology','youNetworks','G&T (Gin and Transit)'];
const MONTHS=[tr('common.jan'),tr('common.feb'),tr('common.mar'),tr('common.apr'),tr('common.may'),tr('common.jun'),tr('common.jul'),tr('common.aug'),tr('common.sep'),tr('common.oct'),tr('common.nov'),tr('common.dec')];
const REG={AM:tr('common.americas'),SA:tr('common.south_america'),EU:tr('common.europe'),AF:tr('common.africa'),AS:tr('common.asia'),OC:tr('common.oceania')};

View file

@ -1,6 +1,6 @@
/* ================= HELPERS ================= */
const fmt$=v=>{const a=Math.abs(v),s=v<0?'-':'';if(a>=1e6)return s+'$'+(a/1e6).toFixed(a>=1e7?1:2)+'M';if(a>=1e3)return s+'$'+(a/1e3).toFixed(a>=1e5?0:1)+'k';return s+'$'+Math.round(a);};
const fmtG=g=>g>=1000?(g/1000).toFixed(g>=10000?1:2)+' Tbps':(g>=100?g.toFixed(0):g.toFixed(1))+' Gbps';
const fmt$=v=>{const a=Math.abs(v),s=v<0?'-':'';if(a>=999.95e6)return s+'$'+(a/1e9).toFixed(a>=9.995e9?1:2)+'B';if(a>=1e6)return s+'$'+(a/1e6).toFixed(a>=1e7?1:2)+'M';if(a>=1e3)return s+'$'+(a/1e3).toFixed(a>=1e5?0:1)+'k';return s+'$'+Math.round(a);};
const fmtG=g=>g>=999950?(g/1e6).toFixed(g>=9.995e6?1:2)+' Pbps':g>=1000?(g/1000).toFixed(g>=10000?1:2)+' Tbps':(g>=100?g.toFixed(0):g.toFixed(1))+' Gbps';
const pct=x=>Math.round(x*100)+'%';
// Reach never rounds up to 100%: Tier 1 needs more than 99.9%, and 99.6% must not look like a full house (#73).
const reachPct=x=>x>0.999?'100%':x>=0.99?(Math.floor(x*1000)/10).toFixed(1)+'%':pct(x);