The NOC tab shows no numbers: a red dot only while something is broken; drop five unused labels

This commit is contained in:
Frederic Jung 2026-10-29 21:36:44 +01:00
parent 3de3e545e1
commit 81ad85cb03
No known key found for this signature in database
11 changed files with 14 additions and 39 deletions

View file

@ -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)=>`<button class="${open&&cur===k?'on':''}" data-act="phoneTab" data-args='{"t":"${k}"}' aria-label="${esc(l)}"><span class="ic" aria-hidden="true">${ic}</span>${esc(l)}${cnt?`<span class="cnt${red?' red':''}">${cnt}</span>`:''}</button>`;
const tab=(k,ic,l,cnt,red)=>`<button class="${open&&cur===k?'on':''}" data-act="phoneTab" data-args='{"t":"${k}"}' aria-label="${esc(l)}"><span class="ic" aria-hidden="true">${ic}</span>${esc(l)}${cnt?(cnt===' '?`<span class="cnt red dot"></span>`:`<span class="cnt${red?' red':''}">${cnt}</span>`):''}</button>`;
const h=(rule('clock')?`<button class="play${UI.speed?'':' paused'}" data-act="phonePlay" aria-label="${UI.speed?tr('common.pause'):tr('common.play')}"><span class="ic" aria-hidden="true">${UI.speed?'❚❚':'▶'}</span>${UI.speed?tr('common.pause'):tr('common.play')}</button>`+
`<button data-act="phoneSpeed" aria-label="${tr('common.game_speed')}"><span class="ic" aria-hidden="true">${UI.speed===0.5?'½':(UI.lastSpeed||UI.speed||1)}×</span>${tr('common.speed')}</button>`:'')+
(()=>{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'),ibxOpen()||'',ibxUrgent()>0);
(()=>{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'),ibxOpen()||'',ibxUrgent()>0);
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){}}

View file

@ -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?` <span class="cnt red">${st.unhappy}</span>`:''}`;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')}<span class="cnt">${ndone}/${GOALS.length}</span>`],['deals',`${tr('common.deals')}${S.offers.length?`<span class="cnt">${S.offers.length}</span>`:''}`],['noc',`NOC${S.inc.length?`<span class="cnt red">${S.inc.length}</span>`:''}`],['nets',`${tr('common.networks')}${ibxOpen()?`<span class="cnt${ibxUrgent()?' red':''}">${ibxOpen()}</span>`:''}`]];
const tabs=[['goals',`${tr('common.goals')}<span class="cnt">${ndone}/${GOALS.length}</span>`],['deals',`${tr('common.deals')}${S.offers.length?`<span class="cnt">${S.offers.length}</span>`:''}`],['noc',`NOC${S.inc.length?`<span class="cnt red dot" aria-hidden="true"></span>`:''}`],['nets',`${tr('common.networks')}${ibxOpen()?`<span class="cnt${ibxUrgent()?' red':''}">${ibxOpen()}</span>`:''}`]];
$('leftTabs').innerHTML=tabs.map(([k,l])=>`<button class="${UI.left===k?'on':''}" data-act="leftTab" data-args='{"t":"${k}"}'>${l}</button>`).join('')+(innerWidth<760?`<button data-act="toggleLeft" style="margin-left:auto" aria-label="${tr('common.close')}">×</button>`:'');
let h='';
if(UI.left==='goals'){

View file

@ -1795,11 +1795,8 @@
"fiber_modals.your_pop_needs_a_fabric_port":"Your POP · needs a fabric port there",
"game_and_settings.delete_and_start_over":"Delete and start over",
"game_and_settings.export_save_download_a_file":"Export save <small>download a file</small>",
"game_and_settings.import_a_save_from_a_file":"Import a save <small>from a file</small>",
"game_and_settings.import_failed_that_save_is_damaged":"<b>Import failed.</b><br>That save is damaged and could not be loaded. Your current game is untouched.",
"game_and_settings.name_and_everything_it_owns_will":"{name} and everything it owns will be deleted. This cannot be undone.",
"game_and_settings.scenarios_amp_weekly_challenge":"Scenarios &amp; weekly challenge",
"game_and_settings.share_your_network_image_card":"Share your network <small>image card</small>",
"game_and_settings.start_a_new_network":"Start a new network?",
"game_and_settings.welcome_back_name_imported_and_saved":"<b>Welcome back, {name}.</b><br>Imported and saved on this device.",
"game_and_settings.your_game_saves_itself_every_few":"Your game saves itself every few seconds on this device.",
@ -2015,7 +2012,6 @@
"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",
"hud_and_panels.n_session_is_down_on_its":{"one":"{n} session is down on its max-prefix limit.","other":"{n} sessions are down on their max-prefix limit."},
"hud_and_panels.n_small_networks":"{n} small networks",
@ -3520,7 +3516,6 @@
"slots.this_window_stopped_saving_so_it":"A newer version was saved in another window, so this one stopped saving instead of overwriting it.",
"slots.two_windows_one_network":"Two windows, one network",
"slots.your_networks":"Your networks",
"slots.your_networks_switch_or_start_another":"Your networks <small>switch, or start another</small>",
"slots.your_other_networks_share_this_browser":"Your other networks share this browser's storage. Export the ones you want to keep, then delete them here to make room.",
"sold_out.a_hyperscaler_bought_every_wave_of":"A hyperscaler bought every wave of that size on this route last week.",
"sold_out.not_big_enough_yet_list":"Not big enough yet: {list}",

View file

@ -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}

View file

@ -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}