NOC notices that would open the NOC get no Open button (#226)
The notice list is the NOC tab, so a target of tab:noc did nothing. #232 gave the shift report a real target; the chaos monkey's arrival still pointed at the NOC, where its own card already is. logSection() now leaves the button off for that target, whatever posts it.
This commit is contained in:
parent
d9f3cede11
commit
dc89369c2a
3 changed files with 14 additions and 1 deletions
|
|
@ -19,11 +19,12 @@ function logNote(html,kind,actions,open){S.log=S.log||[];const tmp=document.crea
|
|||
const logRecent=()=>{const now=Date.now();return (S.log||[]).filter(e=>e.at&&now-e.at<LOG_MS);};
|
||||
const logUnread=()=>logRecent().filter(e=>e.at>(UI.logSeen||0)).length;
|
||||
const agoStr=at=>{const m=Math.floor((Date.now()-at)/60000);return m<1?tr('common.just_now'):trn('notifications.n_min_ago',m);};
|
||||
// The list is the NOC tab: a notice that would open the NOC gets no Open button, since it would do nothing (#226).
|
||||
function logSection(){const L=logRecent(),MAX=5,all=UI.logAll,sh=all?L:L.slice(0,MAX);
|
||||
let h=`<h3 style="font-size:15px;margin:10px 0 4px">${tr('common.notifications')} <span class="meta">${tr('notifications.last_10_minutes')}</span></h3>`;
|
||||
if(!L.length)return h+`<p class="empty">${tr('notifications.nothing_in_the_last_10_minutes')}</p>`;
|
||||
h+=sh.map(e=>{const body=e.h&&e.t.startsWith(e.h)?e.t.slice(e.h.length).trim():e.t;
|
||||
return `<div class="row note ${e.k||'info'}"><span class="ndot" aria-hidden="true"></span><div class="grow">${e.h?`<div class="nm">${esc(e.h)}${e.n>1?` <span class="tag st">×${e.n}</span>`:''}</div>`:''}${body?`<div class="meta nbody">${esc(body)}${!e.h&&e.n>1?` <span class="tag st">×${e.n}</span>`:''}</div>`:''}<div class="meta">${agoStr(e.at)} · ${dateStr(e.d)}</div></div>${e.o?btn(tr('common.open'),'logOpen',{id:e.id},'ghost sm'):''}</div>`;}).join('');
|
||||
return `<div class="row note ${e.k||'info'}"><span class="ndot" aria-hidden="true"></span><div class="grow">${e.h?`<div class="nm">${esc(e.h)}${e.n>1?` <span class="tag st">×${e.n}</span>`:''}</div>`:''}${body?`<div class="meta nbody">${esc(body)}${!e.h&&e.n>1?` <span class="tag st">×${e.n}</span>`:''}</div>`:''}<div class="meta">${agoStr(e.at)} · ${dateStr(e.d)}</div></div>${e.o&&!(e.o.a==='tab'&&e.o.v==='noc')?btn(tr('common.open'),'logOpen',{id:e.id},'ghost sm'):''}</div>`;}).join('');
|
||||
if(L.length>MAX)h+=`<div class="btns">${btn(all?tr('common.show_fewer'):tr('notifications.show_all_n',{n:L.length}),'logAll',{},'ghost sm')}</div>`;
|
||||
return h;}
|
||||
const markLayer=()=>{UI.layerAt=performance.now();};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue