Signals folder under All Subscriptions, with its + on the folder's row (#256)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,11 +12,11 @@ function signalOf(view: string|null){
|
||||
return id===null ? undefined : S.signals.find(s=>s.id===id);
|
||||
}
|
||||
|
||||
/// The Signals folder's place: a folder of their own at the top of the feed list, open or closed as
|
||||
/// an OPML's is (#255). Under the places, a long list of them pushed the feeds down.
|
||||
/// The Signals folder: first in the feed list, under All Subscriptions, open or closed as an OPML's
|
||||
/// is (#255, #256). As rows under the places, a long list of them pushed the feeds down.
|
||||
const SIGNALS=':signals';
|
||||
// Tinted as a feed's initials are: a plain tile vanished into a selected row (see .art.ini).
|
||||
const sigArt=(icon=ICON.signal)=>`<span class="fart"><div class="art ini sig" style="--tint:var(--accent)">${icon}</div></span>`;
|
||||
const sigArt=()=>`<span class="fart"><div class="art ini sig" style="--tint:var(--accent)">${ICON.signal}</div></span>`;
|
||||
function feedRow(id: string, cls: string, html: string, open: ()=>void){
|
||||
const el=document.createElement('div');
|
||||
el.className='feed '+cls+(S.feed===id?' sel':'');
|
||||
@@ -33,9 +33,12 @@ function signalFolder(list: HTMLElement, q: string){
|
||||
list.appendChild(feedRow(SIGNALS,'sigs',
|
||||
`<button class="chev" aria-expanded="${open}" title="Show or hide your signals" aria-label="Show or hide your signals">${ICON.caret}</button>`+
|
||||
sigArt()+`<div class="txt"><b>Signals</b><small>${n?plural(n,'signal'):'What matters, out of the noise'}</small></div>`+
|
||||
badgeHTML(S.signals.reduce((k,s)=>k+s.unread,0)),
|
||||
badgeHTML(S.signals.reduce((k,s)=>k+s.unread,0))+
|
||||
`<button class="iconbtn sigadd" title="New signal" aria-label="New signal">${ICON.plus}</button>`,
|
||||
()=>selectFeed(SIGNALS)));
|
||||
$('.chev',list.lastElementChild!).onclick=(ev: Event)=>{ ev.stopPropagation(); toggleGroup(SIGNALS); };
|
||||
const row=list.lastElementChild!;
|
||||
$('.chev',row).onclick=(ev: Event)=>{ ev.stopPropagation(); toggleGroup(SIGNALS); };
|
||||
$('.sigadd',row).onclick=(ev: Event)=>{ ev.stopPropagation(); signalModal(); nav(false); };
|
||||
if(!open) return;
|
||||
for(const sg of mine){
|
||||
const el=feedRow(':signal:'+sg.id,'child',
|
||||
@@ -44,7 +47,6 @@ function signalFolder(list: HTMLElement, q: string){
|
||||
el.onpointerenter=el.ontouchstart=()=>prefetch(':signal:'+sg.id);
|
||||
list.appendChild(el);
|
||||
}
|
||||
list.appendChild(feedRow(':signal:new','child',sigArt(ICON.plus)+'<div class="txt"><b>New signal</b></div>',()=>signalModal()));
|
||||
}
|
||||
|
||||
/// The folder's page: every Signal, as an OPML's page lists its feeds.
|
||||
@@ -136,6 +138,8 @@ function signalModal(sg?: Signal){
|
||||
const r=sg ? await api(`/api/signals/${sg.id}`,{method:'PATCH',body})
|
||||
: await api('/api/signals',{method:'POST',body});
|
||||
closeModal(); toast(sg?'Saved. Jev reads everything again':'Listening. What Jev picks out shows up here');
|
||||
// Open, so the new one is there to see.
|
||||
if(!expanded.has(SIGNALS)) toggleGroup(SIGNALS);
|
||||
await loadFeeds(true); selectFeed(':signal:'+(sg?sg.id:r.id));
|
||||
}catch(e){ toast(why(e),true); }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user