diff --git a/site/i18n/de.js b/site/i18n/de.js index cafa5db..c255a30 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -1998,7 +1998,6 @@ "hud_and_panels.n_incident":{"one":"{n} Störung","other":"{n} Störungen"}, "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", "hud_and_panels.n_small_networks":"{n} kleine Netze", "hud_and_panels.n_special_requirement":{"one":"{n} Sonderwunsch","other":"{n} Sonderwünsche"}, diff --git a/site/i18n/es.js b/site/i18n/es.js index 00fd43e..6a4af3e 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -1996,7 +1996,6 @@ "hud_and_panels.n_incident":{"one":"{n} incidente","other":"{n} incidentes"}, "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", "hud_and_panels.n_small_networks":"{n} redes pequeñas", "hud_and_panels.n_special_requirement":{"one":"{n} requisito especial","other":"{n} requisitos especiales"}, diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 3cf10fb..b5e12d1 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -1996,7 +1996,6 @@ "hud_and_panels.n_incident":{"one":"{n} incident","other":"{n} incidents"}, "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", "hud_and_panels.n_small_networks":"{n} petits réseaux", "hud_and_panels.n_special_requirement":{"one":"{n} exigence spéciale","other":"{n} exigences spéciales"}, diff --git a/site/i18n/it.js b/site/i18n/it.js index cd54bf0..2afe831 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -1996,7 +1996,6 @@ "hud_and_panels.n_incident":{"one":"{n} incidente","other":"{n} incidenti"}, "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", "hud_and_panels.n_small_networks":"{n} piccole reti", "hud_and_panels.n_special_requirement":{"one":"{n} requisito speciale","other":"{n} requisiti speciali"}, diff --git a/site/i18n/pt.js b/site/i18n/pt.js index fa6d14b..a5af6bb 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -1996,7 +1996,6 @@ "hud_and_panels.n_incident":{"one":"{n} incidente","other":"{n} incidentes"}, "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", "hud_and_panels.n_small_networks":"{n} redes pequenas", "hud_and_panels.n_special_requirement":{"one":"{n} requisito especial","other":"{n} requisitos especiais"}, diff --git a/src/game/93-ui/20-phone.js b/src/game/93-ui/20-phone.js index eafdc9e..9e4cebe 100644 --- a/src/game/93-ui/20-phone.js +++ b/src/game/93-ui/20-phone.js @@ -3,10 +3,10 @@ const isPhone=()=>innerWidth<=760||(innerHeight<=500&&matchMedia('(pointer:coars const SPEEDS=[0.5,1,2,4,8]; function renderTabbar(){const tb=$('tabbar');if(!tb||(pressing&&UI.ticking))return;if(!isPhone()||!S||!UI.started||pzOn()){tb.hidden=true;document.body.classList.toggle('sheet-open',pzOn()&&isPhone()&&!!UI.sel);return;}tb.hidden=false; const open=UI.leftOpen&&!UI.sel,cur=UI.left||'goals',ndone=GOALS.filter(g=>S.done[g.id]!==undefined).length; - const tab=(k,ic,l,cnt,red)=>``; + const tab=(k,ic,l,cnt,red)=>``; const h=(rule('clock')?``+ ``:'')+ - (()=>{const P=scnProg();return tab('goals','🎯',tr('common.goals'),P&&!S.scn.done&&!S.scn.failed?`${Math.round(P.f*100)}%`:`${ndone}/${GOALS.length}`);})()+(()=>{const u=custStats().unhappy;return u?tab('deals','💼',tr('common.deals'),u,true):tab('deals','💼',tr('common.deals'),S.offers.length||'');})()+tab('noc','🚨','NOC',S.inc.length||(UI.left==='noc'&&UI.leftOpen?'':logUnread())||'',S.inc.length>0)+tab('nets','🌐',tr('common.networks'),''); + (()=>{const P=scnProg();return tab('goals','🎯',tr('common.goals'),P&&!S.scn.done&&!S.scn.failed?`${Math.round(P.f*100)}%`:`${ndone}/${GOALS.length}`);})()+(()=>{const u=custStats().unhappy;return u?tab('deals','💼',tr('common.deals'),u,true):tab('deals','💼',tr('common.deals'),S.offers.length||'');})()+tab('noc','🚨','NOC',S.inc.length?' ':'',true)+tab('nets','🌐',tr('common.networks'),''); if(h!==UI._tb){UI._tb=h;tb.innerHTML=h;} document.body.classList.toggle('sheet-open',!!(UI.sel||UI.leftOpen));} function haptic(ms){if(UI.muted)return;try{navigator.vibrate&&navigator.vibrate(ms||12);}catch(e){}} diff --git a/src/game/93-ui/40-hud-and-panels.js b/src/game/93-ui/40-hud-and-panels.js index 066905c..f679918 100644 --- a/src/game/93-ui/40-hud-and-panels.js +++ b/src/game/93-ui/40-hud-and-panels.js @@ -20,7 +20,7 @@ function renderHUD(){ $('hDate').textContent=dateStr(S.day); {const bo=(S.loanOffers||[]).length,hb=$('hBank');hb.hidden=!bo;hb.textContent=bo;} {const st=custStats(),hc=$('hCust');hc.hidden=!st.n;if(st.n){$('hCustVal').innerHTML=`${st.avg>=80?'😀':st.avg>=60?'🙂':st.avg>=30?'😟':'😡'} ${Math.round(st.avg)}%${st.unhappy?` ${st.unhappy}`:''}`;hc.classList.toggle('hot',st.furious>0);}} - const n=S.inc.length;$('hNoc').classList.toggle('hot',n>0);{const u=UI.left==='noc'&&UI.leftOpen?0:logUnread(),b=$('hNocNew');if(b){b.hidden=!u;b.textContent=u>99?'99+':String(u);b.title=trn('hud_and_panels.n_new_notification',u);}}$('hNocVal').textContent=n?trn('hud_and_panels.n_incident',n):tr('common.all_quiet'); + const n=S.inc.length;$('hNoc').classList.toggle('hot',n>0);{const b=$('hNocNew');if(b)b.hidden=true;}$('hNocVal').textContent=n?trn('hud_and_panels.n_incident',n):tr('common.all_quiet'); if(!window.__TUBES_TEST__)fitHud(); renderTabbar(); } @@ -31,7 +31,7 @@ function renderLeft(){checkLayer(); renderTabbar(); if(!S||pzOn()){L.hidden=true;return;}L.hidden=false; const ndone=GOALS.filter(g=>S.done[g.id]!==undefined).length; - const tabs=[['goals',`${tr('common.goals')}${ndone}/${GOALS.length}`],['deals',`${tr('common.deals')}${S.offers.length?`${S.offers.length}`:''}`],['noc',`NOC${S.inc.length?`${S.inc.length}`:''}`],['nets',tr('common.networks')]]; + const tabs=[['goals',`${tr('common.goals')}${ndone}/${GOALS.length}`],['deals',`${tr('common.deals')}${S.offers.length?`${S.offers.length}`:''}`],['noc',`NOC${S.inc.length?``:''}`],['nets',tr('common.networks')]]; $('leftTabs').innerHTML=tabs.map(([k,l])=>``).join('')+(innerWidth<760?``:''); let h=''; if(UI.left==='goals'){ diff --git a/src/i18n/en.js b/src/i18n/en.js index 223c014..bf1a6d8 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -1997,7 +1997,6 @@ "hud_and_panels.n_incident":{"one":"{n} incident","other":"{n} incidents"}, "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", "hud_and_panels.n_small_networks":"{n} small networks", "hud_and_panels.n_special_requirement":{"one":"{n} special requirement","other":"{n} special requirements"}, diff --git a/src/styles/20-drawers.css b/src/styles/20-drawers.css index bd9b547..5f510ec 100644 --- a/src/styles/20-drawers.css +++ b/src/styles/20-drawers.css @@ -83,3 +83,5 @@ section h3{font-size:17px;margin-bottom:6px;display:flex;align-items:center;gap: .inc .nm{font-weight:900} .inc .meta{font-size:12px;color:var(--ink2);margin-top:2px;line-height:1.35} +/* The NOC tab only says whether something is broken, never how many notifications wait (2.0). */ +.cnt.dot{min-width:0;width:9px;height:9px;padding:0;border-radius:50%;vertical-align:middle} diff --git a/src/styles/60-phone.css b/src/styles/60-phone.css index 6bccadf..39cbe7f 100644 --- a/src/styles/60-phone.css +++ b/src/styles/60-phone.css @@ -35,6 +35,7 @@ button,.chip,.b,a{touch-action:manipulation;-webkit-tap-highlight-color:transpar #tabbar button.play.paused{background:#FFE3F0} #tabbar .cnt{position:absolute;top:2px;right:calc(50% - 22px);min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--me);color:#fff;font-size:10px;line-height:16px;box-sizing:border-box} #tabbar .cnt.red{background:var(--bad)} + #tabbar .cnt.dot{min-width:0;width:10px;height:10px;padding:0;top:6px;right:calc(50% - 16px)} #left,#panel{top:auto !important;left:0 !important;right:0 !important;width:auto !important;bottom:var(--tabbar) !important;max-height:min(62%,calc(100% - var(--tabbar) - 70px)) !important;border-radius:20px 20px 0 0 !important;border-bottom:0 !important;box-shadow:0 -3px 0 var(--ink) !important;transition:max-height .22s ease,transform .22s ease;z-index:7} #left.full,#panel.full{max-height:calc(100% - var(--tabbar) - 56px - env(safe-area-inset-top,0px)) !important} #left.closed{display:none} diff --git a/tests/game.test.js b/tests/game.test.js index 13e085a..6f5d817 100644 --- a/tests/game.test.js +++ b/tests/game.test.js @@ -483,14 +483,13 @@ test('notifications: the NOC keeps the last ten minutes, folds repeats and opens assert.equal(ev("S.log.length"), 6, 'a minute later it starts a new line'); // the NOC shows them right after the incidents, with Open where there is something to open assert.equal(ev("logUnread()"), 6); - ev("renderHUD()"); assert.equal(doc.getElementById('hNocNew').hidden, false); assert.equal(doc.getElementById('hNocNew').textContent, '6'); + ev("renderHUD()"); assert.equal(doc.getElementById('hNocNew').hidden, true, 'no unread count on the NOC button (2.0)'); ev("UI.left='noc';UI.leftOpen=true;UI.sel=null;renderLeft();renderHUD()"); const body = doc.getElementById('leftBody').textContent; assert.match(body, /Notifications\s*last 10 minutes/); assert.ok(body.indexOf('Notifications') < body.indexOf('DDoS scrubbing'), 'near the top, not at the bottom'); assert.match(body, /×5/); assert.match(body, /just now/); assert.equal(doc.querySelectorAll('#leftBody [data-act=logOpen]').length, 2, 'Open only where it leads somewhere (2 of the 5 shown)'); - assert.equal(doc.getElementById('hNocNew').hidden, true, 'read once the NOC is open'); assert.equal(ev("logUnread()"), 0); ev("ACT.logAll()"); assert.equal(doc.querySelectorAll('#leftBody .note').length, 6); assert.equal(doc.querySelectorAll('#leftBody [data-act=logOpen]').length, 3); // Open goes there @@ -506,12 +505,15 @@ test('notifications: the NOC keeps the last ten minutes, folds repeats and opens ev("S.log.push({t:'old',k:'weird',o:{a:'city',v:'atlantis'},n:'many'},{t:5},{t:'x',o:{a:'tab',v:'evil'}},{t:'y',o:{a:'link',v:'l1'},at:'soon'});S=sanitize(S)"); const tail = JSON.parse(ev("JSON.stringify(S.log.slice(-3))")); assert.deepEqual(tail.map(e => [e.t, e.k, e.o, e.n, e.at]), [['old', '', null, 1, 0], ['x', '', null, 1, 0], ['y', '', { a: 'link', v: 'l1' }, 1, 0]]); - // phones: the NOC tab carries the count + // phones: the NOC tab shows no numbers, only a red dot while something is broken ev("__tick(1000);toast('Router crashed
Your router in London is rebooting.','bad');UI.left='goals';UI.leftOpen=false"); dom.window.innerWidth = 360; ev("renderAll&&renderAll()"); const nocTab = [...doc.querySelectorAll('#tabbar [data-act=phoneTab]')].find(b => JSON.parse(b.dataset.args).t === 'noc'); - assert.equal(nocTab.querySelector('.cnt').textContent, '1', 'one unread notification on the NOC tab'); - assert.equal(nocTab.querySelector('.cnt').classList.contains('red'), false, 'not red: red is for incidents'); + assert.equal(nocTab.querySelector('.cnt'), null, 'no number for unread notifications on the NOC tab'); + ev("S.inc.push({id:'x1',type:'crash',city:'lon',msg:'',until:S.day+3});renderAll()"); + const nocTab2 = [...doc.querySelectorAll('#tabbar [data-act=phoneTab]')].find(b => JSON.parse(b.dataset.args).t === 'noc'); + assert.ok(nocTab2.querySelector('.cnt.dot.red'), 'a live incident shows a red dot'); + assert.equal(nocTab2.querySelector('.cnt').textContent, '', 'and no number'); assert.deepEqual(errors, []); });