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:
2026-10-16 17:39:04 +00:00
parent 0fdd609791
commit 8d93b58deb
5 changed files with 20 additions and 16 deletions

View File

@@ -104,8 +104,9 @@ function renderFeeds(){
places.appendChild(el);
}
list.appendChild(places);
signalFolder(list,q);
const shown=S.feeds.filter(f=>!q||(f.title||f.id).toLowerCase().includes(q));
if(!shown.length){ signalFolder(list,q); list.insertAdjacentHTML('beforeend','<p class="empty" style="padding:20px 8px">No feeds.</p>'); return done(); }
if(!shown.length){ list.insertAdjacentHTML('beforeend','<p class="empty" style="padding:20px 8px">No feeds.</p>'); return done(); }
// Feeds from a subscribed OPML sit under it, so the group reads as one thing. Pinned feeds
// go first: a folder with its feeds under it, a feed from inside one lifted out of it.
@@ -124,10 +125,7 @@ function renderFeeds(){
// it is open.
const lastTop=order.findIndex(([f,d])=>!d&&!f.pinned);
const lastPin=(lastTop<0?order.filter(([f])=>f.pinned):order.slice(0,lastTop)).pop()?.[0];
// The Signals folder goes under the pinned feeds, which are first because you put them there.
let folder=false;
for(const [f,depth] of order){
if(!folder&&!depth&&!f.pinned){ signalFolder(list,q); folder=true; }
const kids=inside(f).length;
// A subscription holds no entries itself, so its counts are the sum of what is inside --
// taken from every feed it holds, not just the ones a filter left showing.
@@ -171,7 +169,6 @@ function renderFeeds(){
for(const img of $$('img',el)){ const was=drawn.get(img.outerHTML)?.shift(); if(was) img.replaceWith(was); }
list.appendChild(el);
}
if(!folder) signalFolder(list,q);
paintScanning();
done();
}

View File

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