diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dafde6..3f7204b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ All notable changes to this project are documented here. The project follows - The intern only signs a customer after a trial run shows the network can carry them without hurting anyone else, and rushes every repair that has a price, while the budget lasts (#185). The bulk peering and PNI batches live in the Ops sheet, next to the orders that repeat them (#181, #192). - Palau's and the Marshall Islands' main networks now show their real AS numbers instead of ones borrowed from networks elsewhere. - When a new release changes prices so that this week's or a coming week's puzzle no longer adds up, that puzzle gets a fair new budget, and only its stars start again. Weeks that are over keep theirs. +- The Networks list shows 100 networks at a time, with a button for the rest, so it opens quickly now that every country has its own networks. ## [1.37.0] — 2026-10-28 diff --git a/site/i18n/de.js b/site/i18n/de.js index 7fd624d..e9e57f3 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -2014,6 +2014,7 @@ "hud_and_panels.lv_n":"Lv {n}", "hud_and_panels.n_incident":{"one":"{n} Störung","other":"{n} Störungen"}, "hud_and_panels.n_message_waiting_for_an_answer":{"one":"{n} Nachricht wartet auf eine Antwort.","other":"{n} Nachrichten warten auf eine Antwort."}, +"hud_and_panels.n_more_networks":{"one":"+{n} weiteres Netz","other":"+{n} weitere Netze"}, "hud_and_panels.n_networks_d_days_left":"{n} Netze · noch {d} Tage", "hud_and_panels.n_new_notification":{"one":"{n} neue Benachrichtigung","other":"{n} neue Benachrichtigungen"}, "hud_and_panels.n_rules_live":"{n} Regeln aktiv", diff --git a/site/i18n/es.js b/site/i18n/es.js index d300f54..8fa80cc 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -2012,6 +2012,7 @@ "hud_and_panels.lv_n":"Nv {n}", "hud_and_panels.n_incident":{"one":"{n} incidente","other":"{n} incidentes"}, "hud_and_panels.n_message_waiting_for_an_answer":{"one":"{n} mensaje esperando respuesta.","other":"{n} mensajes esperando respuesta."}, +"hud_and_panels.n_more_networks":{"one":"+{n} red más","other":"+{n} redes más"}, "hud_and_panels.n_networks_d_days_left":"{n} redes · quedan {d} días", "hud_and_panels.n_new_notification":{"one":"{n} notificación nueva","other":"{n} notificaciones nuevas"}, "hud_and_panels.n_rules_live":"{n} reglas activas", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index b84b1a5..f10dcd5 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -2012,6 +2012,7 @@ "hud_and_panels.lv_n":"Niv. {n}", "hud_and_panels.n_incident":{"one":"{n} incident","other":"{n} incidents"}, "hud_and_panels.n_message_waiting_for_an_answer":{"one":"{n} message attend une réponse.","other":"{n} messages attendent une réponse."}, +"hud_and_panels.n_more_networks":{"one":"+{n} autre réseau","other":"+{n} autres réseaux"}, "hud_and_panels.n_networks_d_days_left":"{n} réseaux · {d} j restants", "hud_and_panels.n_new_notification":{"one":"{n} nouvelle notification","other":"{n} nouvelles notifications"}, "hud_and_panels.n_rules_live":"{n} règles actives", diff --git a/site/i18n/it.js b/site/i18n/it.js index 94f2d17..3f3f7d3 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2012,6 +2012,7 @@ "hud_and_panels.lv_n":"Liv. {n}", "hud_and_panels.n_incident":{"one":"{n} incidente","other":"{n} incidenti"}, "hud_and_panels.n_message_waiting_for_an_answer":{"one":"{n} messaggio aspetta una risposta.","other":"{n} messaggi aspettano una risposta."}, +"hud_and_panels.n_more_networks":{"one":"+{n} altra rete","other":"+{n} altre reti"}, "hud_and_panels.n_networks_d_days_left":"{n} reti · {d} giorni rimasti", "hud_and_panels.n_new_notification":{"one":"{n} nuova notifica","other":"{n} nuove notifiche"}, "hud_and_panels.n_rules_live":"{n} regole attive", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 38ee4f2..634078f 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -2012,6 +2012,7 @@ "hud_and_panels.lv_n":"Nv {n}", "hud_and_panels.n_incident":{"one":"{n} incidente","other":"{n} incidentes"}, "hud_and_panels.n_message_waiting_for_an_answer":{"one":"{n} mensagem esperando resposta.","other":"{n} mensagens esperando resposta."}, +"hud_and_panels.n_more_networks":{"one":"+{n} rede a mais","other":"+{n} redes a mais"}, "hud_and_panels.n_networks_d_days_left":"{n} redes · faltam {d} dias", "hud_and_panels.n_new_notification":{"one":"{n} notificação nova","other":"{n} notificações novas"}, "hud_and_panels.n_rules_live":"{n} regras ativas", diff --git a/src/game/90-actions/10-interface.js b/src/game/90-actions/10-interface.js index 70dc725..2efcb05 100644 --- a/src/game/90-actions/10-interface.js +++ b/src/game/90-actions/10-interface.js @@ -30,7 +30,7 @@ const ACT={ tab:({t})=>{UI.tab=t;UI.confirm=null;renderPanel();}, leftTab:({t})=>{UI.left=t;UI.leftOpen=true;renderLeft();}, netFocus:({id})=>{if(!NET[id])return;$('dash').hidden=true;UI.netFocus=id;UI.nf='all';UI.left='nets';UI.leftOpen=true;UI.sel=null;renderPanel();renderLeft();const b=$('leftBody');if(b)b.scrollTop=0;}, - netFilter:({f})=>{UI.nf=f==='out'?'out':'all';UI.netFocus=null;$('dash').hidden=true;UI.left='nets';UI.leftOpen=true;UI.sel=null;renderPanel();renderLeft();const b=$('leftBody');if(b)b.scrollTop=0;}, + netFilter:({f})=>{UI.nf=f==='out'?'out':'all';listReset('nets');UI.netFocus=null;$('dash').hidden=true;UI.left='nets';UI.leftOpen=true;UI.sel=null;renderPanel();renderLeft();const b=$('leftBody');if(b)b.scrollTop=0;}, meetGo:({city})=>{if(!isCity(city))return;$('dash').hidden=true;ACT.focusCity({city});if(S.pops[city]){UI.tab='peer';renderPanel();}}, toggleLeft:()=>{UI.leftOpen=!UI.leftOpen;renderLeft();}, phoneTab:({t})=>{if(!['goals','deals','noc','nets'].includes(t))return;if($('modal').classList.contains('link-check'))closeModal();haptic(8);if(UI.leftOpen&&UI.left===t&&!UI.sel){UI.leftOpen=false;}else{UI.left=t;UI.leftOpen=true;UI.sel=null;renderPanel();}$('left').classList.remove('full');renderLeft();}, diff --git a/src/game/90-actions/70-dashboard-lists.js b/src/game/90-actions/70-dashboard-lists.js index 41d9ff6..3bb414b 100644 --- a/src/game/90-actions/70-dashboard-lists.js +++ b/src/game/90-actions/70-dashboard-lists.js @@ -1,6 +1,6 @@ Object.assign(ACT,{ custGo:({id})=>{const b=S.biz.find(x=>x.id===id);if(!b)return;$('dash').hidden=true;ACT.focusCity({city:b.city});UI.tab='cust';renderPanel();}, - listMore:({k})=>{if(k!=='conn'&&k!=='cust')return;UI.listN=UI.listN||{};UI.listN[k]=listN(k)+LIST_PAGE;renderDash();}, + listMore:({k})=>{if(k!=='conn'&&k!=='cust'&&k!=='nets')return;UI.listN=UI.listN||{};UI.listN[k]=listN(k)+LIST_PAGE;if(k==='nets'){renderLeft();return;}renderDash();}, custF:({v})=>{UI.kf=UI.kf||{};UI.kf.f=v==='sad'?'sad':'';listReset('cust');renderDash();}, custCity:({v})=>{UI.kf=UI.kf||{};UI.kf.city=isCity(v)?v:'';listReset('cust');renderDash();}, custSort:({k})=>{if(!['mood','mo','name','city'].includes(k))return;listReset('cust');if(UI.custSort===k)UI.custDir=-(UI.custDir||1);else{UI.custSort=k;UI.custDir=k==='mo'?-1:1;}renderDash();}, diff --git a/src/game/93-ui/40-hud-and-panels.js b/src/game/93-ui/40-hud-and-panels.js index 90ccb82..8991ade 100644 --- a/src/game/93-ui/40-hud-and-panels.js +++ b/src/game/93-ui/40-hud-and-panels.js @@ -79,8 +79,11 @@ function renderLeft(){checkLayer(); const foc=UI.netFocus&&NET[UI.netFocus]?NET[UI.netFocus]:null,out=!foc&&UI.nf==='out',lostN=ntLost().length; h+=`
${btn(tr('common.all_networks'),'netFilter',{f:'all'},!foc&&!out?'sm':'ghost sm')}${btn(tr('hud_and_panels.out_of_reach_without_transit_n',{n:lostN}),'netFilter',{f:'out'},out?'sm':'ghost sm')}
`; if(out&&!lostN)h+=`

${tr('hud_and_panels.nothing_every_network_is_reachable')}

`; - for(const n of foc?[foc]:out?ntLost():NETS){if(n.tail&&!UI.tailOpen&&!foc&&!out)continue; + // Shown 100 at a time like the dashboard lists: every country's own eyeballs made this list long (2.0). + const nl=(foc?[foc]:out?ntLost():NETS).filter(n=>!n.tail||UI.tailOpen||foc||out); + for(const n of nl.slice(0,listN('nets'))){ h+=`
${logo(n)}
${esc(n.name)} AS${n.asn}
${TYPE_L[n.type]} ${n.pol} · ${tr('hud_and_panels.p_of_traffic',{p:(NSH[n.id]*100).toFixed(1)})}${n.price?` · ${tr('hud_and_panels.transit_price_gbps',{price:(n.price*S.priceMul).toFixed(2)})}`:''}
${esc(n.blurb)}
${netWhere(n,where)}${(foc||out)&&!R.nt[n.id]?`

${esc(offTransitHint(n.id))}

`:''}${(foc||out)&&coneVia(n.id)&&(R.cone[n.id]||!R.nt[n.id])?`

${R.cone[n.id]?tr('hud_and_panels.reached_through_the_customer_cone_of',{net:esc((NET[R.cone[n.id]]||coneVia(n.id)).name)}):tr('hud_and_panels.buys_transit_from_net_peer_with',{net:esc(coneVia(n.id).name)})}

`:''}${foc||out&&!R.nt[n.id]?meetLine(n,foc?24:4):''}
`;} + h+=listMore('nets',nl.length,n=>trn('hud_and_panels.n_more_networks',n)); if(!foc&&!out)h+=`
${tr('hud_and_panels.the_long_tail')} ${tr('hud_and_panels.n_small_networks',{n:tl.length})}
${tr('hud_and_panels.p_of_traffic_between_them_scattered',{p:(tl.reduce((a,n)=>a+NSH[n.id],0)*100).toFixed(1),n:tlOn})}
${btn(UI.tailOpen?tr('common.hide'):tr('common.show'),'tailTog',{},'ghost sm')}
`; } if(h!==UI._lh){UI._lh=h;morph($('leftBody'),h);} diff --git a/src/i18n/en.js b/src/i18n/en.js index a0e51dc..ba42357 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -2013,6 +2013,7 @@ "hud_and_panels.lv_n":"Lv {n}", "hud_and_panels.n_incident":{"one":"{n} incident","other":"{n} incidents"}, "hud_and_panels.n_message_waiting_for_an_answer":{"one":"{n} message waiting for an answer.","other":"{n} messages waiting for an answer."}, +"hud_and_panels.n_more_networks":{"one":"+{n} more network","other":"+{n} more networks"}, "hud_and_panels.n_networks_d_days_left":"{n} networks · {d} days left", "hud_and_panels.n_new_notification":{"one":"{n} new notification","other":"{n} new notifications"}, "hud_and_panels.n_rules_live":"{n} rules live", diff --git a/tests/networks-list.test.js b/tests/networks-list.test.js new file mode 100644 index 0000000..307bfbf --- /dev/null +++ b/tests/networks-list.test.js @@ -0,0 +1,18 @@ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +test('the Networks list shows 100 networks at a time, with a button for the rest', () => { + const { ev, errors } = load(); + ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();UI.left='nets';UI.leftOpen=true;UI.tailOpen=false;ACT.netFilter({f:'all'})"); + const total = ev("NETS.filter(n=>!n.tail).length"); + assert.ok(total > 100, 'enough networks to page'); + const rows = () => ev("[...document.querySelectorAll('#left .row .nm .meta')].filter(e=>/^AS\\d/.test(e.textContent)).length"); + assert.equal(rows(), 100); + assert.ok(ev("!!document.querySelector('#left [data-act=listMore]')")); + ev("document.querySelector('#left [data-act=listMore]').click()"); + assert.equal(rows(), Math.min(total, 200)); + ev("ACT.netFilter({f:'all'})"); + assert.equal(rows(), 100, 'a new filter starts at the first page again'); + assert.deepEqual(errors, []); +});