From dbd2fa7b55ded4759eb8c21a1f49cf91c2a23e0f Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 30 Oct 2026 15:48:49 +0100 Subject: [PATCH] Routers: the picture in the POP overview's header, left of the city name --- CHANGELOG.md | 2 +- src/game/93-ui/50-city-panel.js | 6 ++++-- src/styles/37-router-art.css | 6 ++++-- tests/router-art.test.js | 8 ++++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43127be..a6882e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/game/93-ui/50-city-panel.js b/src/game/93-ui/50-city-panel.js index 9af838b..2b34ea2 100644 --- a/src/game/93-ui/50-city-panel.js +++ b/src/game/93-ui/50-city-panel.js @@ -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=`
${REG[C.reg]} · ${esc(siteName(c,'a'))}

${C.name}

+ // 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=`
${art?`${art}`:''}
${REG[C.reg]} · ${esc(siteName(c,'a'))}

${C.name}

${tr('city_panel.g_of_eyeballs',{g:fmtG(eyeP(c))})}${grantFact(c)}${latSlow(c)?`🐢 ${tr('city_panel.ms_ms_to_transit',{ms:Math.round(R.latFar[c].ms)})}`:''}${regionMult(c)>1?`${tr('city_panel.transit_x_pricier',{x:regionMult(c)})}`:''}${C.kr&&scnRule('sender')?`${tr('city_panel.sender_pays_fee_per_gbps',{fee:fmt$(KR_FEE)})}`:''}${colo(c)>1?`${tr('city_panel.few_data_centers_pops_x',{x:colo(c)})}`:''}${C.reg==='AS'&&!C.cn?''+tr('city_panel.underserved_users_grow_60_faster')+'':''}${ix?`${tr('city_panel.ix_ix',{ix:esc(ix)})}`:''}${p?`${tr('common.your_pop')}`:''}${down?`DOWN`:''}
`; 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+=`

${tr('common.routers')}

${tr('city_panel.the_model_sets_your_fastest')}

-
${rgArt(g)?`${rgArt(g)}`:``}
${rt} × ${esc(G.n)}
${tr('city_panel.up_to_pn_interfaces_ports_ports',{pn:G.pn,ports:G.ports,cap:fmtG(G.cap)})} · ${esc(G.blurb)}
+
${rt} × ${esc(G.n)}
${tr('city_panel.up_to_pn_interfaces_ports_ports',{pn:G.pn,ports:G.ports,cap:fmtG(G.cap)})} · ${esc(G.blurb)}
${tr('common.router_ports')}${tr('city_panel.used_max_in_use',{used:fmtPorts(pu),max:pm})}
${pu>=pm?`

${tr('city_panel.every_port_is_taken_add_a')}

`:''}
${tr('common.forwarding_chip')}${esc(G.chip)}
${tr('common.boot_time')}${slowBoot(c)?`${tr('city_panel.n_min_a_slow_one',{n:bootMin(c)})}`:tr('city_panel.n_min',{n:bootMin(c)})}
${slowBoot(c)?`

${tr('city_panel.this_chassis_takes_forever_to_boot')}

`:''}
${tr('common.forwarding_load')}${fmtG(nl)} / ${fmtG(nc)}
diff --git a/src/styles/37-router-art.css b/src/styles/37-router-art.css index 18dc6aa..f78ef52 100644 --- a/src/styles/37-router-art.css +++ b/src/styles/37-router-art.css @@ -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}} diff --git a/tests/router-art.test.js b/tests/router-art.test.js index eb90cde..7c289e3 100644 --- a/tests/router-art.test.js +++ b/tests/router-art.test.js @@ -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, []); });