Some checks failed
CI / plan (push) Has been cancelled
CI / build (push) Has been cancelled
CI / translations (push) Has been cancelled
Container image / gate (push) Has been cancelled
CI / part (push) Has been cancelled
CI / test (push) Has been cancelled
CI / timings (push) Has been cancelled
Container image / test (push) Has been cancelled
Container image / publish (push) Has been cancelled
- Until a zone's first circuit or spur is up, its row and panel say when the islands come online instead of homes out of 0 and a red 0% served (wisp-commissioning-homes-of-zero). - Once your own constellation flies, a zone's Starblink row points to GEO, MEO or a spur (wisp.leo_no_rivals), never to a pie dish (zone-leo-pie-dish-advice). - The late joiner's welcome and bank note say the match is on home broadband, not island Wi-Fi, in all six languages (late-match-island-homes). - A gateway's section shows its city's transit ports (Transit out of the city) and warns when they fill; the fiber row only where there is fiber (leo-backhaul-transit-only). - Spurs are subsea cable, no longer unrepeatered, in every language and the catalog comment (spur-unrepeatered-1400km). - French calls a spur a câble de dérivation, not a câble d'antenne (fr-spur-cable-antenna).
67 lines
9.7 KiB
JavaScript
67 lines
9.7 KiB
JavaScript
// Island Wi-Fi on screen (#83): a city's fact chip and teaser, the zones in its Customers tab, their rows at the teleport.
|
|
// Rows are laid out as the teleport section's (name, meta, a bar, small buttons that wrap), so they fit a phone at 360 px.
|
|
const wispFact=c=>{if(!wispOn())return '';const n=wispAt(c).length;return n?`<span class="fact">🏝️ ${trn('wisp.n_zones',n)}</span>`:'';};
|
|
// A city without a POP of yours: what its islands are, and that a POP comes first.
|
|
function wispNoPop(c){if(!wispOn()||S.pops[c])return '';const zs=wispAt(c);if(!zs.length)return '';
|
|
return `<section><h3>🏝️ ${tr('wisp.section')}</h3><p class="lead">${tr('wisp.no_pop',{list:zs.map(z=>`<b>${esc(WISP[z].n)}</b> (${tr('wisp.pool',{g:fmtG(wispPool(z))})})`).join(', ')})}</p></section>`;}
|
|
// A zone's status: what carries it today, or why nothing does.
|
|
function wispStatus(z,Z){if(!Z)return {t:tr('wisp.st_none'),k:'st'};if(wispLit(Z))return wispCut(z)?{t:tr('wisp.st_cut'),k:'restrictive'}:{t:tr('wisp.st_spur'),k:'open'};
|
|
const o=Z.sat;if(o&&!(o.ready>S.day))return {t:SAT_ORB[wispOrb(o)].n,k:''};return o||Z.sp?{t:tr('wisp.st_soon'),k:'st'}:{t:tr('wisp.st_none'),k:'st'};}
|
|
// Days until the first of a zone's circuits or spur being commissioned comes up; 0 for none.
|
|
const wispSoon=Z=>[Z.sat,Z.nxt,Z.sp].reduce((m,o)=>o&&o.ready>S.day&&(!m||o.ready-S.day<m)?o.ready-S.day:m,0);
|
|
// In a POP's Customers tab, after Home broadband: one row per zone, one of them open at a time (UI.wz). Until something
|
|
// reaches the islands nobody is online: the row says when they will be, not a red 0% served.
|
|
function wispHtml(c){if(!wispOn()||!S.pops[c])return '';const zs=wispAt(c);if(!zs.length)return '';
|
|
return `<section><h3>🏝️ ${tr('wisp.section')}</h3><p class="lead">${tr('wisp.lead',{rate:fmt$(wispRate(zs[0]))})}</p>${zs.map(wispRow).join('')}</section>`;}
|
|
function wispRow(z){const W=WISP[z],Z=wispZ(z),r=R.wisp&&R.wisp[z],P=wispPool(z),st=wispStatus(z,Z),open=UI.wz===z,d=Z?Z.d:0,sf=r?r.sf:0,on=!!Z&&wispTake(Z)>0,n=Z&&!on?wispSoon(Z):0;
|
|
let h=`<div class="row"><div class="grow"><div class="nm">${esc(W.n)} <span class="tag ${st.k}">${st.t}</span></div><div class="meta">${tr('wisp.pool',{g:fmtG(P)})}${on?' · '+tr('pie_gov.served',{p:pct(sf)}):n?' · '+tr('city_panel.ready_in_n_d',{n}):''}</div>${on?`<div class="bar me"><i style="width:${Math.min(100,d/P*100)}%"></i></div>`:''}</div>${btn(open?tr('common.close'):tr('common.open'),'wispOpen',{z},'ghost sm')}</div>`;
|
|
return open?h+wispOpenHtml(z,Z,r):h;}
|
|
// The open zone: its homes and money (once something reaches them; until then, the day it will), its backhaul (the
|
|
// circuit, the birds to order on), the spur, closing it. A cut spur or a solar storm is an outage: that one shows in red.
|
|
function wispOpenHtml(z,Z,r){const K=Z?wispK(z,Z):0,k=Z?wispLink(z,Z):null;let h='';
|
|
if(Z){const sf=r?r.sf:0,cl=sf<0.9?'var(--tx-red,var(--bad))':'var(--eye)',n=K>0?0:wispSoon(Z);
|
|
h+=K>0?`<div class="kv"><span>${tr('wisp.homes_online')}</span><b>${tr('city_panel.a_of_b',{a:fmtG(Z.d),b:fmtG(K)})}</b></div>
|
|
<div class="kv"><span>${tr('wisp.served')}</span><b style="color:${cl}">${pct(sf)}</b></div>
|
|
<div class="kv"><span>${tr('common.revenue')}</span><b>${tr('common.price_mo',{price:fmt$(r?r.d*r.sf*wispRate(z):0)})}</b></div>`:n?`<p class="note">${trn('wisp.online_in_n_days',n)}</p>`:'';
|
|
h+=`<div class="kv"><span>${tr('wisp.upkeep')}</span><b>${tr('common.price_mo',{price:fmt$(wispUpMo(z)+(wispLit(Z)?wispSpurMo(z):0))})}</b></div>
|
|
${k&&r&&r.d>=k.g*0.98?`<p class="why">${tr('wisp.full')}</p>`:''}`;}
|
|
h+=`<p class="note">${tr('wisp.take',{geo:pct(SAT_ORB.geo.wisp),meo:pct(SAT_ORB.meo.wisp),leo:pct(SAT_ORB.leo.wisp)})}</p>${ip4On()?`<p class="note">${tr('wisp.ipv6')}</p>`:''}`;
|
|
return `<div class="wisp">${h}${wispBackhaul(z,Z,k)}${wispSpurHtml(z,Z)}${Z?`<div class="btns">${btn(UI.confirm==='wz:'+z?tr('satellites.really_close_it'):tr('wisp.close'),'wispRm',{z},'ghost sm')}</div>`:''}</div>`;}
|
|
// Backhaul: the circuit (and a move under way), then a row per bird that sees both the city and the islands.
|
|
function wispBackhaul(z,Z,k){const W=WISP[z],c=W.c,C=CITY[c].name,t=teleOf(c);
|
|
let h=`<h4 class="sub4">${tr('wisp.backhaul')}</h4>`;
|
|
if(satOnly(c))h+=`<p class="why">${tr('wisp.double_hop',{city:C})}</p>`;
|
|
const o=Z&&Z.sat,run=(x,now)=>{const O=SAT_ORB[wispOrb(x)],P=SAT_PROV[SATS[x.bird].p],car=now&&k===x&&R.wisp&&R.wisp[z]?R.wisp[z].car:0,u=x.g?car/x.g:0,sb=now&&k&&k.sp;
|
|
return `<div class="row">${satLogo(P)}<div class="grow"><div class="nm">${esc(SATS[x.bird].n)} <span class="tag">${O.n}</span>${sb?` <span class="tag st">${tr('common.standby')}</span>`:''}</div><div class="meta">${fmtCap(x.g)} · ${tr('satellites.ms_round_trip',{ms:Math.round(2*wispMs(z,x.bird))})} · ${tr('common.price_mo',{price:fmt$(x.mo)})}${x.ready>S.day?' · '+tr('city_panel.ready_in_n_d',{n:x.ready-S.day}):''}</div>
|
|
${now&&wispOrb(x)==='leo'&&leoStorm()?`<p class="why">${trn('satellites.leo_safe_mode_n_days',S.ev.sky-S.day)}</p>`:''}${now?`<div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div>`:''}</div></div>`;};
|
|
if(o){const G=SAT_ORB[wispOrb(o)].g;h+=run(o,true)+`<div class="btns">${G.filter(g=>g!==o.g).map(g=>btn(`${g>o.g?tr('satellites.grow_to',{cap:fmtCap(g)}):tr('satellites.shrink_to',{cap:fmtCap(g)})} <small>${tr('common.price_mo',{price:fmt$(wispSatMo(o.bird,g))})}</small>`,'wispSatSize',{z,g},'sm',g>o.g&&S.cash<wispSatMo(o.bird,g))).join('')}${btn(UI.confirm==='wsat:'+z?tr('common.really_cancel'):tr('common.cancel_circuit'),'wispSatRm',{z},'ghost sm')}</div>`;}
|
|
if(Z&&Z.nxt)h+=run(Z.nxt,false);
|
|
if(!t){h+=`<p class="note">${tr('wisp.no_teleport',{city:C})}</p><div class="btns">${btn(tr('satellites.build_a_teleport_cost_mo',{cost:fmt$(TPORT_COST),mo:fmt$(TPORT_MO)}),'teleBuild',{city:c},'sm',S.cash<TPORT_COST||!!teleWhy(c))}</div>`;return h;}
|
|
if(Z&&Z.nxt)return h;
|
|
h+=o?`<p class="note">${tr('wisp.move_note')}</p>`:Z?'':`<p class="note">${tr('wisp.kit',{cost:fmt$(wispKit(z))})}</p>`;
|
|
const kit=Z?0:wispKit(z);
|
|
for(const id of wispBirds(z)){if(o&&o.bird===id)continue;const B=SATS[id],O=SAT_ORB[B.orb],P=SAT_PROV[B.p];if(lvl()<O.lv)continue;
|
|
// The teleport's own upgrade, where the bird needs one: tracking antennas for MEO, a Starblink gateway for LEO (and why
|
|
// that cannot go up, when it cannot). None once your own constellation flies: wispSatWhy says what the islands have left.
|
|
const trk=B.orb==='meo'&&t<2,gw=B.orb==='leo'&&!leoGw(c)&&!leoRival(),why=(trk?trkWhy(c):gw?leoGwWhy(c):'')||wispSatWhy(z,id);
|
|
const up=trk?btn(tr('satellites.add_tracking_antennas_cost_mo',{cost:fmt$(TRK_COST),mo:fmt$(TRK_MO)}),'teleTrk',{city:c},'sm',S.cash<TRK_COST||!!trkWhy(c))
|
|
:gw?btn(tr('satellites.host_leo_gateway_cost_mo',{cost:fmt$(LEO_GW_COST),mo:fmt$(LEO_GW_MO)}),'teleLeo',{city:c},'sm',S.cash<LEO_GW_COST||!!leoGwWhy(c)):'';
|
|
h+=`<div class="row">${satLogo(P)}<div class="grow"><div class="nm">${esc(B.n)} <span class="tag">${O.n}</span></div><div class="meta">${esc(P.n)} · ${tr('satellites.ms_round_trip',{ms:Math.round(2*wispMs(z,id))})} · ${trn('satellites.up_in_n_days',leadDays(O.days))}</div>${why?`<div class="why">${esc(why)}</div>`:''}
|
|
<div class="btns">${up||O.g.map(g=>btn(`${fmtCap(g)} <small>${tr('common.price_mo',{price:fmt$(wispSatMo(id,g))})}</small>`,'wispSat',{z,bird:id,g},'sm',!!why||S.cash<wispSatMo(id,g)+kit)).join('')}</div></div></div>`;}
|
|
return h;}
|
|
// The spur: what it costs and takes, laying it, lit, or cut (with the incident's own rush button).
|
|
function wispSpurHtml(z,Z){const W=WISP[z],c=W.c;let h=`<h4 class="sub4">${tr('wisp.spur')}</h4>`;
|
|
if(!W.km)return h+`<p class="note">${tr('wisp.spur_none')}</p>`;
|
|
const sp=Z&&Z.sp;
|
|
if(!sp){const why=wispSpurWhy(z),cost=wispSpurCost(z)+(Z?0:wispKit(z));
|
|
return h+`<p class="lead">${tr('wisp.spur_lead',{km:W.km.toLocaleString(),city:CITY[c].name})}</p><div class="meta">${tr('common.price_mo',{price:fmt$(wispSpurMo(z))})} · ${trn('satellites.up_in_n_days',wispSpurDays(z))}</div>
|
|
${why?`<div class="why">${esc(why)}</div>`:''}${lvl()<WISP_SPUR_LV?'':`<div class="btns">${btn(tr('wisp.lay_spur',{cost:fmt$(cost)}),'wispSpur',{z},'pink sm',!!why||S.cash<cost)}</div>`}`;}
|
|
if(sp.ready>S.day){const tot=Math.max(1,sp.ready-sp.day),done=clamp((S.day-sp.day)/tot,0,1);
|
|
return h+`<div class="kv"><span>${tr('wisp.spur_laying')}</span><b>${tr('common.n_days_left',{n:sp.ready-S.day})}</b></div><div class="bar me"><i style="width:${done*100}%"></i></div>`;}
|
|
const cut=wispCut(z);if(!cut)return h+`<div class="kv"><span>${tr('wisp.spur_lit',{cap:fmtCap(WISP_SPUR_G)})}</span><b>${W.km.toLocaleString()} km</b></div>`;
|
|
const i=S.inc.filter(x=>x.type==='wspur'&&x.z===z).sort((a,b)=>b.until-a.until)[0],up=!!Z.sat&&!(Z.sat.ready>S.day);
|
|
return h+`<p class="why">${trn('wisp.spur_cut',cut-S.day)}</p>${i&&i.cost?`<div class="btns">${btn(`${esc(i.fix||tr('common.rush_repair'))} ${fmt$(i.cost)}`,'fixInc',{id:i.id},'red sm',S.cash<i.cost)}</div>`:''}${up?'':`<p class="note">${tr('wisp.spur_trap')}</p>`}`;}
|
|
// In the teleport section: the zones' circuits from here, each opening its zone.
|
|
function wispTeleRows(c){const zs=wispSats(c);if(!zs.length)return '';
|
|
return `<div class="meta">${tr('wisp.tele_reaches')}</div>`+zs.map(z=>{const Z=wispZ(z),o=Z.sat||Z.nxt,k=wispLink(z,Z),car=R.wisp&&R.wisp[z]&&k===Z.sat?R.wisp[z].car:0,u=Z.sat&&Z.sat.g?car/Z.sat.g:0;
|
|
return `<div class="row"><div class="grow"><div class="nm">🏝️ ${esc(WISP[z].n)}${k&&k.sp&&Z.sat?' <span class="tag st">'+tr('common.standby')+'</span>':''}</div><div class="meta">${fmtCap(o.g)} · ${esc(SATS[o.bird].n)}${o.ready>S.day?' · '+tr('city_panel.ready_in_n_d',{n:o.ready-S.day}):''} · ${tr('common.price_mo',{price:fmt$(o.mo)})}</div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div></div>${btn(tr('common.open'),'wispOpen',{z},'ghost sm')}</div>`;}).join('');}
|