Routers: the picture in the POP overview's header, left of the city name
This commit is contained in:
parent
78d2b7c8c9
commit
dbd2fa7b55
4 changed files with 15 additions and 7 deletions
|
|
@ -10,7 +10,7 @@ All notable changes to this project are documented here. The project follows
|
|||
|
||||
## [2.0.0] — 2026-10-29
|
||||
|
||||
- Every router model has its own picture: open a POP's routers to meet the one it runs.
|
||||
- Every router model has its own picture: open one of your POPs and its router sits next to the city's name.
|
||||
- A new Architect run every week: every Sunday a fresh HQ somewhere in the world and six or seven briefs, each built around the network you already have, with its own stars. Sites can outgrow their tubes, so some briefs are about making room. Later briefs stay a surprise in every Architect run: their cities only appear when they come.
|
||||
- In puzzles, the map now shows whether the tubes between two cities share one trench or take separate paths, at any zoom: one trench is drawn as a bundle with a "2× one trench" tag, separate paths bow apart with a "2 paths" tag.
|
||||
- Every puzzle now has the chaos monkey: when your build earns a new star, it runs round the map snipping each trench and cable in turn, and the cities that lose traffic say how much. Let it loose again whenever you like, or skip straight to the stars.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
function cityPanel(c){
|
||||
const C=CITY[c],p=S.pops[c],ix=ixName(c),down=p&&p.down>S.day;
|
||||
let h=`<div class="ph"><div style="min-width:0"><div class="eyebrow">${REG[C.reg]} · ${esc(siteName(c,'a'))}</div><h2>${C.name}</h2>
|
||||
// Your POP's router model, as a picture left of the name (10-catalog/25-router-art.js).
|
||||
const art=p?rgArt(p.rgen||0):'';
|
||||
let h=`<div class="ph">${art?`<span class="rgpic big phpic">${art}</span>`:''}<div style="min-width:0"><div class="eyebrow">${REG[C.reg]} · ${esc(siteName(c,'a'))}</div><h2>${C.name}</h2>
|
||||
<div class="facts"><span class="fact">${tr('city_panel.g_of_eyeballs',{g:fmtG(eyeP(c))})}</span>${grantFact(c)}${latSlow(c)?`<span class="fact bad">🐢 ${tr('city_panel.ms_ms_to_transit',{ms:Math.round(R.latFar[c].ms)})}</span>`:''}${regionMult(c)>1?`<span class="fact">${tr('city_panel.transit_x_pricier',{x:regionMult(c)})}</span>`:''}${C.kr&&scnRule('sender')?`<span class="fact">${tr('city_panel.sender_pays_fee_per_gbps',{fee:fmt$(KR_FEE)})}</span>`:''}${colo(c)>1?`<span class="fact">${tr('city_panel.few_data_centers_pops_x',{x:colo(c)})}</span>`:''}${C.reg==='AS'&&!C.cn?'<span class="fact ixf">'+tr('city_panel.underserved_users_grow_60_faster')+'</span>':''}${ix?`<span class="fact ixf">${tr('city_panel.ix_ix',{ix:esc(ix)})}</span>`:''}${p?`<span class="fact mine">${tr('common.your_pop')}</span><button class="fact trb" data-act="trace" data-args='{"city":"${c}"}'>🔍 ${tr('common.traceroute')}</button>`:''}${down?`<span class="fact down">DOWN</span>`:''}</div></div>
|
||||
<button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div>`;
|
||||
if(!p){
|
||||
|
|
@ -65,7 +67,7 @@ function cityPanel(c){
|
|||
const ls=S.links.filter(l=>l.a===c||l.b===c);
|
||||
const rt=p.routers||1,g=p.rgen||0,G=RG[g],nl=R.nodeLoad[c]||0,nc=R.nodeCap[c]||nodeCap(c),Ni=g===mainRG(G.cls)?mainRG(G.cls+1):-1,N=Ni>=0?RG[Ni]:null,pu=portsUsed(c),pm=portsMax(c);
|
||||
h+=`<section><h3>${tr('common.routers')}</h3><p class="lead">${tr('city_panel.the_model_sets_your_fastest')}</p>
|
||||
<div class="row rgrow">${rgArt(g)?`<span class="rgpic big">${rgArt(g)}</span>`:`<span class="logo" style="--c:${G.badge?'#2C7A7B':'#FF4F9A'}">${G.badge||'R'+(G.cls+1)}</span>`}<div class="grow"><div class="nm">${rt} × ${esc(G.n)}</div><div class="meta">${tr('city_panel.up_to_pn_interfaces_ports_ports',{pn:G.pn,ports:G.ports,cap:fmtG(G.cap)})} · ${esc(G.blurb)}</div></div></div>
|
||||
<div class="row"><span class="logo" style="--c:${G.badge?'#2C7A7B':'#FF4F9A'}">${G.badge||'R'+(G.cls+1)}</span><div class="grow"><div class="nm">${rt} × ${esc(G.n)}</div><div class="meta">${tr('city_panel.up_to_pn_interfaces_ports_ports',{pn:G.pn,ports:G.ports,cap:fmtG(G.cap)})} · ${esc(G.blurb)}</div></div></div>
|
||||
<div class="kv"><span>${tr('common.router_ports')}</span><b>${tr('city_panel.used_max_in_use',{used:fmtPorts(pu),max:pm})}</b></div><div class="bar ${barCls(pu/pm)}"><i style="width:${Math.min(100,pu/pm*100)}%"></i></div>${pu>=pm?`<p class="why">${tr('city_panel.every_port_is_taken_add_a')}</p>`:''}
|
||||
<div class="kv"><span>${tr('common.forwarding_chip')}</span><b>${esc(G.chip)}</b></div><div class="kv"><span>${tr('common.boot_time')}</span><b>${slowBoot(c)?`<span style="color:var(--bad)">${tr('city_panel.n_min_a_slow_one',{n:bootMin(c)})}</span>`:tr('city_panel.n_min',{n:bootMin(c)})}</b></div>${slowBoot(c)?`<p class="note">${tr('city_panel.this_chassis_takes_forever_to_boot')}</p>`:''}
|
||||
<div class="kv"><span>${tr('common.forwarding_load')}</span><b>${fmtG(nl)} / ${fmtG(nc)}</b></div><div class="bar ${barCls(nl/nc)}"><i style="width:${Math.min(100,nl/nc*100)}%"></i></div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
/* Router pictures (src/game/10-catalog/25-router-art.js): each on a small map-green stage, the same in both themes. */
|
||||
/* Router pictures (src/game/10-catalog/25-router-art.js): your POP's model in the city panel's header, left of the
|
||||
name, on a small map-green stage that looks the same in both themes. */
|
||||
.rgpic{flex:0 0 auto;display:block;width:58px;height:46px;border:2px solid #1E2640;border-radius:10px;background:radial-gradient(circle at 50% 125%,#94D168 0 55%,#A8DE7C 56%);overflow:hidden}
|
||||
.rgpic.big{width:96px;height:77px;border-width:3px;border-radius:14px}
|
||||
.rgpic .rgart{display:block;width:100%;height:100%}
|
||||
.row.rgrow{align-items:center}
|
||||
.ph .phpic{align-self:center}
|
||||
@media (max-width:420px){.rgpic.big{width:76px;height:61px}}
|
||||
|
|
|
|||
|
|
@ -17,11 +17,15 @@ test('every router model has a picture, and each one is valid SVG', () => {
|
|||
assert.equal(ev('rgArt(99)'), '');
|
||||
});
|
||||
|
||||
test('only the POP overview shows a picture: the model in use', () => {
|
||||
test('only the POP overview shows a picture: its model, left of the city name', () => {
|
||||
const { ev, errors, dom } = load();
|
||||
ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;selectCity(S.home);UI.tab='links';UI.models=true;renderAll()");
|
||||
const pics = dom.window.document.querySelectorAll('#panel .rgpic');
|
||||
assert.equal(pics.length, 1, 'the model in use only, not the list of other models');
|
||||
assert.ok(dom.window.document.querySelector('#panel .rgpic.big svg.rgart'), 'the one in use, big');
|
||||
assert.ok(dom.window.document.querySelector('#panel .ph > .rgpic.big svg.rgart'), 'in the header, beside the name');
|
||||
ev("UI.tab='cust';renderAll()");
|
||||
assert.equal(dom.window.document.querySelectorAll('#panel .rgpic').length, 1, 'on every tab');
|
||||
ev("selectCity(Object.keys(CITY).find(c=>!S.pops[c]&&!CITY[c].off));renderAll()");
|
||||
assert.equal(dom.window.document.querySelectorAll('#panel .rgpic').length, 0, 'no POP, no router');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue