NOC tab and Pie Control tidied for phones: Pie Control in the NOC top row, traceroute in Routing & DDoS, government money in the bank
- NOC tab: Pie Control is a button in the top row next to "Open NOC dashboard" (only once the rocket
company is unlocked) and replaces the Pie in the Sky card; a spat waiting for an answer keeps its card.
The Connections button is gone (it lives in the NOC dashboard), and the traceroute moved into the
Routing & DDoS modal as an entry that opens the unchanged traceroute modal.
- Government money (Rural Digital Pie Fund, Pitcairn grant, Ex-Im Pie Bank) is a section of the bank,
shown with a rocket company or anything of the fund's to show. pieGovOpen, the action the toasts use,
opens the bank there; pieTab({t:'gov'}) does too.
- Pie Control has four tabs (Traffic, Company, Launch, Dishes) in one segmented control that fits 360 px,
styled like the HUD's speed buttons. The Founder's posts and the orbit books moved into the Company tab,
newest three posts shown and the rest folded. A stale UI.pieTab of 'gov', 'book' or 'founder' falls back.
- Agent docs for pieGovOpen, pieTab, routingOpen and connOpen; the route fuzzer drops connOpen from the
NOC tab on both pages to stay in lockstep with main.
- Tests: tests/noc-panel-layout.test.js, and the pie tests follow the moves.
This commit is contained in:
parent
176a6995b1
commit
9d74873edb
22 changed files with 207 additions and 68 deletions
|
|
@ -97,7 +97,10 @@ function pieGovFix(g,s){const o=pieGovBlank(),day=s.day,ob=x=>x&&typeof x==='obj
|
|||
function pieEximFix(s){const ccs=new Set(CITIES.map(c=>c.cc)),home=isCity(s.home)?CITY[s.home].cc:CITIES[0].cc;
|
||||
for(const l of s.loans||[]){if(l.bank!=='exim')continue;const q=l.pie&&typeof l.pie==='object'?l.pie:{};
|
||||
l.pie={cc:ccs.has(q.cc)?q.cc:home,n:int(q.n,0,1e5,0),by:int(q.by,0,s.day+PIE_EXIM_BY,0),flown:int(q.flown,0,1e6,0),br:int(q.br,0,1e4,0)};l.covs=['pielaunch','piedish'];}}
|
||||
/* ---- Pie Control: the Gov tab ---- */
|
||||
/* ---- The bank's Government money section (it was Pie Control's Gov tab) ---- */
|
||||
// Shown once there is a rocket company, or anything of the fund's or the Ex-Im bank's to show.
|
||||
function pieGovShow(){const P=S&&S.pie;return !!(P&&pieOn()&&(P.co||P.gov.auc.length||P.gov.aw.length||P.gov.ex||pieEximLoan()));}
|
||||
function pieGovBank(){return pieGovShow()?`<section class="bank-gov"><h3 id="bankGov" style="font-size:18px;margin-top:14px">🏛️ ${tr('pie_gov.section')}</h3><p class="meta">${tr('pie_gov.section_note')}</p>${pieGovHtml()}</section>`:'';}
|
||||
function pieGovHtml(){const P=S.pie,G=P.gov,can=pieCanBuild();let h=`<div class="ops-o"><div class="nm">🏛️ ${tr('pie_gov.rdf')}</div><p class="meta">${tr('pie_gov.rdf_note',{y:PIE_RDF_TERM/360,p:pct(PIE_RDF_NEED),c:pct(PIE_RDF_CLAW)})}</p>`;
|
||||
for(const a of G.auc)h+=`<div class="kv"><span>${esc(CITY[a.city].name)} · ${tr('pie_gov.up_to',{mo:fmt$(a.ask)})}</span><b>${tr('pie_gov.closes',{d:dateStr(a.close)})}</b></div>
|
||||
<div class="ops-p">${PIE_RDF_BIDS.map(f=>btn(tr('pie_gov.ask',{mo:fmt$(Math.round(a.ask*f))}),'pieBid',{id:a.id,f},a.bid===f?'pink sm':'ghost sm',!can)).join('')}</div>`;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Pie in the Sky (60-features/99-pie-in-the-sky.js): every action checks pieCanBuild() for anything new.
|
||||
const pieRe=()=>{after();if(!$('modal').hidden&&$('modal').className==='pie')pieModal();};
|
||||
const pieRe=()=>{after();if(!$('modal').hidden&&$('modal').className==='pie')pieModal();if(!$('bankBox').hidden)renderBank();};
|
||||
const pieNo=why=>{toast(why,'bad');sfx('err');pieRe();};
|
||||
Object.assign(ACT,{
|
||||
pieOpen:()=>{if(!S||pzOn()||!pieOn())return;UI.confirm=null;pieModal();},
|
||||
|
|
@ -28,13 +28,13 @@ Object.assign(ACT,{
|
|||
pieSafe:()=>{const P=pieGet();if(!P||!P.co)return;P.safe=!P.safe;sfx('click');pieRe();},
|
||||
pieName:()=>{const P=pieGet();if(!P||!P.co)return;const i=PIE_NAMES.indexOf(P.co.name);P.co.name=PIE_NAMES[(i+1)%PIE_NAMES.length];pieFounder(N_('pie.fp_rename'));pieRe();},
|
||||
pieRename:()=>{const P=pieGet(),el=$('pieNm');if(!P||!P.co||!el)return;const v=el.value.replace(/\s+/g,' ').trim().slice(0,40);if(!v)return;P.co.name=v;pieFounder(N_('pie.fp_rename'));pieRe();},
|
||||
// Government money (60-features/99-pie-subsidies.js): Pie Control's Gov tab, a bid, the Ex-Im loan.
|
||||
pieGovOpen:()=>{if(!S||pzOn()||!pieOn())return;UI.pieTab='gov';UI.confirm=null;pieModal();},
|
||||
// Government money (60-features/99-pie-subsidies.js): its section in the bank, a bid, the Ex-Im loan. It was Pie Control's Gov tab; the name stays for old toasts.
|
||||
pieGovOpen:()=>{if(!S||pzOn()||!pieOn())return;if(!$('modal').hidden)closeModal();ACT.bank();const g=$('bankGov');if(g&&g.scrollIntoView)g.scrollIntoView({block:'start'});},
|
||||
pieBid:({id,f})=>{const P=pieGet();f=+f;const a=P&&P.gov.auc.find(x=>x.id===id);if(!a||!PIE_RDF_BIDS.includes(f))return;if(!pieCanBuild())return pieNo(tr('pie.why_not_t1'));
|
||||
a.bid=f;toast(tr('pie_gov.t_bid',{city:esc(CITY[a.city].name),mo:fmt$(Math.round(a.ask*f)),d:dateStr(a.close)}),'good');sfx('click');pieRe();},
|
||||
pieExim:()=>{const P=pieGet();if(!P||!P.co)return;if(!pieCanBuild())return pieNo(tr('pie.why_not_t1'));if(!pieEximTake())return pieRe();
|
||||
const l=pieEximLoan();toast(`<b>${tr('interface.amt_from_bank_has_landed',{amt:fmt$(l.amount),bank:esc(BANKS.exim.name)})}</b><br>${loanSummary(l)}`,'good');sfx('coin');pieRe();},
|
||||
pieTab:({t})=>{if(!PIE_TABS.includes(t))return;UI.pieTab=t;pieModal();},
|
||||
pieTab:({t})=>{if(t==='gov')return ACT.pieGovOpen();if(!PIE_TABS.includes(t)&&t!=='book'&&t!=='founder')return;UI.pieTab=pieTabOf(t);pieModal();},
|
||||
pieHi:({id})=>{if(typeof id!=='string')return;sfx('click');pieHiSet(id);},
|
||||
pieCity:({v})=>{if(!S||!S.pops[v])return;UI.pieCity=v;pieModal();},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ function renderLeft(){checkLayer();
|
|||
h+=`<div class="row"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · <b>${bTerms(o)}</b> · ${tr('ui.n_d_left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('hud_and_panels.n_special_requirement',o.reqs.length)}`:''}</div>${o.refN?`<div class="meta">${tr('lifecycle.referred_by',{name:esc(o.refN)})}</div>`:''}${spotWhy(o)}${bRisk(o)}${reqList(o)}
|
||||
<div class="btns">${has?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):btn(tr('common.go_there'),'focusCity',{city:bCities(o).find(c=>!S.pops[c])},'ghost sm')}${btn(tr('common.decline'),'decline',{id:o.id},'ghost sm')}</div>${has?'':`<div class="why">${tr('hud_and_panels.needs_a_pop_in_cities',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div></div>`;}
|
||||
}else if(UI.left==='noc'){
|
||||
h+=`<div class="btns" style="margin-bottom:8px">${btn(tr('hud_and_panels.open_noc_dashboard'),'dash',{},'pink')}${btn(tr('common.connections'),'connOpen',{},'')}${btn(tr('common.traceroute'),'trace',{},'')}${btn(`⚙️ ${tr('routing.routing_and_ddos')}${S.te&&!coreTE()?'<span class="cnt red dot" aria-hidden="true"></span>':''}`,'routingOpen',{},'')}</div>`;
|
||||
h+=`<div class="btns" style="margin-bottom:8px">${btn(tr('hud_and_panels.open_noc_dashboard'),'dash',{},'pink')}${pieNocBtn()}${btn(`⚙️ ${tr('routing.routing_and_ddos')}${S.te&&!coreTE()?'<span class="cnt red dot" aria-hidden="true"></span>':''}`,'routingOpen',{},'')}</div>`;
|
||||
h+=`<p class="lead">${tr('hud_and_panels.your_network_operations_center_every')}</p>`;
|
||||
h+=opsCard()+pieCard()+mkCard()+ddosPanel();
|
||||
h+=opsCard()+pieSpatCard()+mkCard()+ddosPanel();
|
||||
// Incidents come first, the ones you can fix with one click at the top (#63): no scrolling past hot ports to replace an optic.
|
||||
for(const i of S.inc.filter(i=>i.type!=='ddos').sort((a,b)=>(b.cost?1:0)-(a.cost?1:0)||(b.impact||0)-(a.impact||0))){h+=`<div class="inc"><div class="nm">${incTitle(i.type)}</div><div class="meta">${esc(i.msg)}</div><div class="meta">${shipSea(i)?'🚢 '+esc(shipStatus(i)):trn('hud_and_panels.auto_fix_in_n_day',i.until-S.day)}${i.impact?` · ${tr('hud_and_panels.g_lost',{g:fmtG(i.impact)})}`:''}</div>${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>`:''}</div>`;}
|
||||
h+=logSection();UI.logSeen=Date.now();
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
/* ---------- Routing & DDoS: one modal for the network-wide settings ----------
|
||||
The backbone, Auto-TE and DDoS automation used to sit at the bottom of the NOC tab, below every incident and
|
||||
the log, where nobody found them. A button at the top of the NOC tab opens them here. */
|
||||
the log, where nobody found them. A button at the top of the NOC tab opens them here, with the traceroute. */
|
||||
// Auto-TE: paused, installed or for sale.
|
||||
function tePanel(){
|
||||
return S.te&&!coreTE()?`<div class="kv"><span>Auto-TE</span><b>${tr('core.paused')}</b></div><p class="why">${tr('core.auto_te_is_paused_it_needs')}</p>`:S.te?`<div class="kv"><span>Auto-TE</span><b>${S.te.on?tr('hud_and_panels.on_moving_g_onto_alternate_paths',{g:fmtG(R.teMoved||0)}):tr('common.off')}</b></div><div class="btns">${btn(S.te.on?tr('hud_and_panels.turn_auto_te_off'):tr('hud_and_panels.turn_auto_te_on'),'teToggle',{},'ghost sm')}${btn(S.te.script?tr('common.edit_routescript'):tr('hud_and_panels.write_a_routescript'),'teEdit',{},'pink sm')}</div>${S.te.script?`<p class="meta" style="margin:2px 0 6px">RouteScript: ${teRules()?tr('hud_and_panels.n_rules_live',{n:teRules().n}):S.te.on?tr('hud_and_panels.has_errors_not_running'):tr('common.controller_off')}${R.teBlack?` · ${tr('hud_and_panels.blackholing_g',{g:fmtG(R.teBlack)})}`:''}</p>`:''}`
|
||||
:`<div class="kv"><span>Auto-TE</span><b>${lvl()<3?tr('hud_and_panels.unlocks_at_customer_level_3'):tr('common.not_installed')}</b></div><p class="meta" style="margin:2px 0 6px">${tr('hud_and_panels.traffic_takes_the_shortest_path_even')}</p>${coreTE()?'':`<p class="why">${tr('core.auto_te_needs_an_rsvp_te_or')}</p>`}<div class="btns">${btn(tr('hud_and_panels.install_auto_te_cost_mo_mo',{cost:fmt$(TE_COST),mo:fmt$(TE_MO)}),'buyTE',{},'pink sm',lvl()<3||S.cash<TE_COST||!coreTE())}</div>`;}
|
||||
// What the modal holds, without its title (scripts/lib/fuzz-page.js reads its buttons too).
|
||||
function routingBody(){return corePanel()+`<h3 style="font-size:15px;margin:8px 0 4px">${tr('common.traffic_engineering')}</h3>${tePanel()}`
|
||||
// Traceroute opens its own modal from here: it explains the routing these settings shape.
|
||||
function routingBody(){return `<div class="row rt-trace"><div class="grow"><div class="nm">🔎 ${tr('common.traceroute')}</div><div class="meta">${tr('routing.trace_note')}</div></div>${btn(tr('routing.trace_run'),'trace',{},'sm')}</div>`+corePanel()+`<h3 style="font-size:15px;margin:8px 0 4px">${tr('common.traffic_engineering')}</h3>${tePanel()}`
|
||||
+`<h3 style="font-size:15px;margin:8px 0 4px">${tr('routing.ddos_defence')}</h3>${ddosSettings()}`;}
|
||||
function routingModal(){if(!S)return;const card=$('modalCard'),open=!$('modal').hidden&&card.querySelector('[data-routing]'),st=open?card.scrollTop:0;
|
||||
let h=`<div data-routing style="display:flex;align-items:center"><div><div class="eyebrow">NOC</div><h2 style="font-size:26px">${tr('routing.routing_and_ddos')}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
|
||||
|
|
|
|||
|
|
@ -1,24 +1,29 @@
|
|||
// Pie Control: a plain modal (a bottom sheet on phones) for the rocket company. Reached from the NOC tab (pieCard()).
|
||||
// Pie Control: a plain modal (a bottom sheet on phones) for the rocket company. Reached from the NOC tab (pieNocBtn()).
|
||||
let PIE_CCN=null;
|
||||
function pieLicCountry(cc){try{PIE_CCN=PIE_CCN&&PIE_CCN.l===LANG?PIE_CCN:{l:LANG,d:new Intl.DisplayNames([LANG],{type:'region'})};return PIE_CCN.d.of(cc)||cc;}catch(e){return cc;}}
|
||||
function pieCard(){if(!pieOn())return '';const P=S.pie;
|
||||
return `<div class="ops-card pie-card"><div class="nm">🥧 ${tr('pie.pie_in_the_sky')}</div><div class="meta">${P&&P.co?esc(pieCoName())+' · '+tr('pie.card_live',{n:Object.keys(CRUSTS).reduce((a,id)=>a+pieLive(id),0),q:P.q.length}):tr('pie.card_pitch')}</div>
|
||||
${pieSpatCard()}<div class="btns">${btn(tr('pie.open_pie_control'),'pieOpen',{},P&&P.co?'sm':'pink sm')}</div></div>`;}
|
||||
const PIE_TABS=['traffic','co','fly','dish','gov','book'];
|
||||
// Pie Control sits in the NOC tab's top row once the rocket company is unlocked; a spat waiting for an answer keeps its own card lower down.
|
||||
function pieNocBtn(){if(!pieOn())return '';return btn(`🥧 ${tr('pie.open_pie_control')}`,'pieOpen',{},'');}
|
||||
const PIE_TABS=['traffic','co','fly','dish'];
|
||||
// The tab UI.pieTab names, or the one that took its place: Gov moved to the bank, the Founder's feed into Company.
|
||||
const pieTabOf=t=>PIE_TABS.includes(t)?t:t==='book'||t==='founder'?'co':'traffic';
|
||||
const PIE_FEED_TOP=3;
|
||||
const pieTag=(t,on)=>`<span class="tag ${on?'open':'selective'}">${t}</span>`;
|
||||
function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pieCanBuild(),T=PIE_TABS.includes(UI.pieTab)?UI.pieTab:'traffic';
|
||||
function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pieCanBuild(),T=UI.pieTab=pieTabOf(UI.pieTab);
|
||||
let h=`<div style="display:flex;align-items:center"><div class="grow"><div class="eyebrow">${tr('pie.pie_in_the_sky')}</div><h2 style="font-size:24px">${P.co?esc(pieCoName()):tr('pie.pie_control')}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>`;
|
||||
if(!can)h+=`<p class="why">${tr('pie.why_not_t1')}</p>`;
|
||||
if(pieSand())h+=`<p class="note">${tr('pie.sandbox_note',{amt:fmt$(P.book.wouldHave)})}</p>`;
|
||||
if(!P.co){h+=`<p class="lead">${tr('pie.found_pitch')}</p><div class="btns">${btn(tr('pie.found_price',{price:fmt$(piePrice(PIE_CO)),mo:fmt$(PIE_CO_MO)}),'pieFound',{},'pink',!can)}</div>`;openModal(h,'pie');return;}
|
||||
const tab=(k,l)=>`<button class="b sm ${T===k?'pink':'ghost'}" data-act="pieTab" data-args='{"t":"${k}"}' aria-pressed="${T===k}">${l}</button>`;
|
||||
const tab=(k,l)=>`<button class="${T===k?'on':''}" data-act="pieTab" data-args='{"t":"${k}"}' aria-pressed="${T===k}">${l}</button>`;
|
||||
h+=pieGlobeHtml()+pieSpatCard();
|
||||
h+=`<div class="seg" style="margin:6px 0 10px">${tab('traffic',tr('pie_traffic.tab'))}${tab('co',tr('pie.tab_company'))}${tab('fly',tr('pie.tab_launch'))}${tab('dish',tr('pie.tab_dishes'))}${tab('gov',tr('pie_gov.tab'))}${tab('book',tr('pie.tab_founder'))}</div>`;
|
||||
h+=`<div class="segc pie-tabs">${tab('traffic',tr('pie_traffic.tab'))}${tab('co',tr('pie.tab_company'))}${tab('fly',tr('pie.tab_launch'))}${tab('dish',tr('pie.tab_dishes'))}</div>`;
|
||||
const cities=Object.keys(S.pops).sort((a,b)=>CITY[a].name.localeCompare(CITY[b].name)),c=S.pops[UI.pieCity]?UI.pieCity:cities[0];
|
||||
const sel=`<div class="trsel"><label>${tr('common.your_pop')}<select data-chg="pieCity">${cities.map(x=>`<option value="${x}"${x===c?' selected':''}>${esc(CITY[x].name)}</option>`).join('')}</select></label></div>`;
|
||||
if(T==='traffic')h+=pieTrafficHtml();
|
||||
else if(T==='co'){
|
||||
h+=`<div class="kv"><span>${tr('pie.running_costs')}</span><b>${tr('common.price_mo',{price:fmt$(pieMo())})}</b></div>`;
|
||||
h+=`<div class="kv"><span>${tr('pie.spent')}</span><b>${fmt$(P.book.spent)}</b></div><div class="kv"><span>${tr('pie.earned')}</span><b>${fmt$(P.book.earned)}</b></div>`;
|
||||
if(R&&R.pie)h+=`<p class="meta">${tr('pie.earned_mo',{amt:fmt$(R.pie.rev),n:R.pie.isl.length})}</p>`;
|
||||
if(pieSand())h+=`<div class="kv"><span>${tr('pie.would_have')}</span><b>${fmt$(P.book.wouldHave)}</b></div>`;
|
||||
h+=`<div class="ops-o${P.fac?' on':''}"><div class="nm">🏭 ${tr('pie.factory')}</div><div class="meta">${P.fac?tr('pie.factory_stock',{n:Math.floor(P.stock),m:PIE_FAC_MONTH}):tr('pie.factory_pitch',{m:PIE_FAC_MONTH,mo:fmt$(PIE_FAC_MO)})}</div>${P.fac?'':`<div class="btns">${btn(tr('pie.build_price',{price:fmt$(piePrice(PIE_FAC))}),'pieFactory',{},'pink sm',!can)}</div>`}</div>`;
|
||||
h+=`<div class="ops-o"><div class="nm">🧪 ${tr('pie.rd')}</div>${Object.keys(PIE_RD).map(k=>`<div class="kv"><span>${tr(PIE_RD[k].n)}</span>${P.rd[k]?`<b>✓</b>`:btn(fmt$(piePrice(PIE_RD[k].cost)),'pieRd',{k},'ghost sm',!can)}</div>`).join('')}
|
||||
${P.rd.heavy?`<p class="meta">${tr('pie.heavy_tests',{n:P.rd.heavyTests,max:PIE_HEAVY_TESTS})}</p>`:''}</div>`;
|
||||
|
|
@ -27,6 +32,7 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi
|
|||
h+=`<div class="ops-o"><div class="nm">🏷️ ${tr('pie.name')}</div><div class="btns">${btn(tr('pie.next_name'),'pieName',{},'ghost sm')}</div>
|
||||
<div class="network-name" style="margin-top:6px"><input class="t" id="pieNm" maxlength="40" value="${esc(pieCoName())}" autocomplete="off" aria-label="${esc(tr('pie.name'))}"></div><div class="btns">${btn(tr('slots.rename'),'pieRename',{},'ghost sm')}</div></div>`;
|
||||
h+=`<div class="btns">${btn(P.safe?tr('pie.safe_on'):tr('pie.safe_off'),'pieSafe',{},P.safe?'red sm':'ghost sm')}</div><p class="meta">${tr('pie.safe_note')}</p>`;
|
||||
h+=pieFeedHtml(P.founder);
|
||||
}else if(T==='fly'){
|
||||
let nudge=false;
|
||||
h+=Object.keys(CRUSTS).map(id=>{const C=CRUSTS[id],cv=pieCov(id);return `<div class="ops-o${pieUp(id)?' on':''}"><div class="nm">${tr(C.n)} ${pieTag(pieBaked(id)?tr('pie.baked'):tr('pie.half_baked'),pieBaked(id))}</div>
|
||||
|
|
@ -51,12 +57,10 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi
|
|||
const ccs=[...new Set([...P.dishes.map(x=>CITY[x.city].cc),CITY[c].cc,...Object.keys(P.lic)])];
|
||||
h+=`<h3 style="font-size:15px;margin:10px 0 4px">${tr('pie.landing_rights')}</h3>`+ccs.map(cc=>{const l=P.lic[cc],ok=pieLicOk(cc);
|
||||
return `<div class="kv"><span>${esc(pieLicCountry(cc))}${ok?' · '+tr('pie.lic_until',{d:dateStr(l.until)}):l&&l.state!=='ok'&&l.until>S.day?' · '+tr('pie.lic_refused'):''}</span>${btn((ok?tr('pie.renew'):tr('pie.buy'))+' '+fmt$(pieLicPrice(cc)),'pieLic',{cc},'ghost sm')}</div>`;}).join('');
|
||||
}else if(T==='gov')h+=pieGovHtml();
|
||||
else{
|
||||
const F=P.founder;h+=`<div class="kv"><span>${tr('pie.promises')}</span><b>${tr('pie.promises_line',{n:F.promises,b:F.broken})}</b></div>`;
|
||||
h+=`<div class="kv"><span>${tr('pie.spent')}</span><b>${fmt$(P.book.spent)}</b></div><div class="kv"><span>${tr('pie.earned')}</span><b>${fmt$(P.book.earned)}</b></div>`;
|
||||
if(R&&R.pie)h+=`<p class="meta">${tr('pie.earned_mo',{amt:fmt$(R.pie.rev),n:R.pie.isl.length})}</p>`;
|
||||
if(pieSand())h+=`<div class="kv"><span>${tr('pie.would_have')}</span><b>${fmt$(P.book.wouldHave)}</b></div>`;
|
||||
h+=`<h3 style="font-size:15px;margin:10px 0 4px">${tr('pie.founder_feed')}</h3>`+(F.posts.length?F.posts.map(p=>`<div class="ops-rep"><div class="eyebrow">${esc(dateStr(p.d))}</div><div>${esc(pieFpText(p))}</div></div>`).join(''):`<p class="meta">${tr('pie.feed_empty')}</p>`);
|
||||
}
|
||||
openModal(h,'pie');{const cv=document.querySelector('#modal .pgcv');if(cv)pieGlobeOpen(cv,pieGlobeData);}}
|
||||
// The Founder's posts are flavour: the newest few at the bottom of the Company tab, the older ones folded away.
|
||||
function pieFeedHtml(F){const post=p=>`<div class="ops-rep"><div class="eyebrow">${esc(dateStr(p.d))}</div><div>${esc(pieFpText(p))}</div></div>`,top=F.posts.slice(0,PIE_FEED_TOP),more=F.posts.slice(PIE_FEED_TOP);
|
||||
return `<div class="pie-feed"><h3>${tr('pie.founder_feed')}</h3><div class="kv"><span>${tr('pie.promises')}</span><b>${tr('pie.promises_line',{n:F.promises,b:F.broken})}</b></div>`
|
||||
+(top.length?top.map(post).join(''):`<p class="meta">${tr('pie.feed_empty')}</p>`)
|
||||
+(more.length?`<details><summary>${trn('pie.feed_older',more.length)}</summary>${more.map(post).join('')}</details>`:'')+'</div>';}
|
||||
|
|
|
|||
|
|
@ -29,5 +29,6 @@ function renderBank(){
|
|||
${B.equity?`<div class="meta">${tr('bank.taking_pct_of_your_revenue_every',{pct:pct(l.share)})}</div>`:`<div class="kv"><span>${tr('common.still_owed')}</span><b>${fmt$(l.bal)}</b></div><div class="bar me"><i style="width:${Math.min(100,(1-l.bal/l.amount)*100)}%"></i></div><div class="meta">${loanLine(l)}</div>`}
|
||||
${covList(l)}${l.breach>=1?`<div class="why">${trn('bank.condition_broken_for_n_day',l.breach)} ${l.breach<10?tr('bank.penalty_in_n_days',{n:10-l.breach}):tr('bank.penalties_are_running')}</div>`:''}
|
||||
<div class="btns" style="margin-top:6px">${btn(UI.confirm===l.id?tr('bank.really_pay_price',{price:fmt$(cost)}):B.equity?tr('bank.buy_them_out_price',{price:fmt$(cost)}):tr('bank.repay_early_price_incl_2_fee',{price:fmt$(cost)}),'repayLoan',{id:l.id},UI.confirm===l.id?'red sm':'sm',S.cash<cost)}</div></div></div>`;}
|
||||
h+=pieGovBank();
|
||||
if(h!==UI._bh){UI._bh=h;$('bankCard').innerHTML=h;}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue