Podcasts shelf: your podcasts as their artwork (#474)
A place beside Up Next listing every feed with audio or video as a grid of its artwork, with how many episodes are new, as Overcast's home screen does. It is drawn from the feed list the page already holds; the feed list gains `podcast`, an EXISTS per subscription over enclosures, which stops at a podcast's first episode and is one index probe for a feed with no files. Its cost on production's database is not measured: the EXPLAIN was not run. The iOS app's generated messages (ios/Sources/Wire) are not regenerated: there is no protoc here. Nothing in the app reads the new fields, and a proto3 reader skips a field it does not know. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -310,6 +310,7 @@ async function renderListed(v: {title: string, icon: string, url?: string, blurb
|
||||
await renderDirectory(v.url!,$('#directory'),n=>{ if(VIEWS[S.feed ?? '']===v) $('#count').textContent=`${v.title}: ${plural(n,'feed')}`; });
|
||||
return;
|
||||
}
|
||||
if(v===VIEWS[':podcasts']){ drawShelf(box); return; }
|
||||
$<HTMLInputElement>('#epSearch').setAttribute('aria-label','Search items');
|
||||
box.innerHTML=`
|
||||
<div class="fhead slim">
|
||||
@@ -324,6 +325,25 @@ async function renderListed(v: {title: string, icon: string, url?: string, blurb
|
||||
n=>{ if(VIEWS[S.feed ?? '']===v) $('#count').textContent=`${v.title}: ${plural(n,'episode')}`; });
|
||||
}
|
||||
|
||||
/// The Podcasts shelf (#474): every feed with audio or video, as its artwork, with how many of its
|
||||
/// episodes are new. A tap opens it. The search box narrows it by name.
|
||||
function drawShelf(box: HTMLElement){
|
||||
$<HTMLInputElement>('#epSearch').setAttribute('aria-label','Search podcasts');
|
||||
const q=S.q.trim().toLowerCase();
|
||||
const shows=S.feeds.filter(f=>f.podcast&&(!q||(f.title||f.id).toLowerCase().includes(q)));
|
||||
$('#count').textContent=`Podcasts: ${plural(shows.length,'podcast')}`;
|
||||
box.innerHTML=shows.length?'<div class="shelf"></div>'
|
||||
:`<p class="hint">${q?`No podcast is called “${esc(S.q)}”.`:'No podcasts yet. Add a feed with episodes in it, and it shows here.'}</p>`;
|
||||
const shelf=$('.shelf',box);
|
||||
for(const f of shows){
|
||||
const name=f.title||f.id, b=document.createElement('button');
|
||||
b.type='button'; b.className='show';
|
||||
b.innerHTML=`${artHTML(f.image,name)}<b>${esc(name)}</b><small>${f.unread?`${f.unread} new`:''}</small>`;
|
||||
b.onclick=()=>selectFeed(f.id);
|
||||
shelf.appendChild(b);
|
||||
}
|
||||
}
|
||||
|
||||
/// Currently Listening: episodes you started and have not finished, across every feed you
|
||||
/// subscribe to. A row resumes the episode in the player bar on click -- a shortcut back to
|
||||
/// where you left off, not another way to browse. The one in the player pauses instead.
|
||||
@@ -410,7 +430,7 @@ $<HTMLInputElement>('#epSearch').oninput=(ev: Event)=>{ clearTimeout(searchT);
|
||||
// server (#126, #127).
|
||||
searchT=setTimeout(()=>{ S.q=(ev.target as HTMLInputElement).value; S.offset=0;
|
||||
if(S.feed===':directory'){ dirShow=null; drawDirectory(); }
|
||||
else if(S.feed===':listening') renderListed(VIEWS[':listening']);
|
||||
else if(S.feed===':listening'||S.feed===':podcasts') renderListed(VIEWS[S.feed]);
|
||||
else loadEntries(); },250); };
|
||||
// Crossing the phone breakpoint moves the files between their pane and the text.
|
||||
window.matchMedia?.('(max-width:820px)')?.addEventListener?.('change',()=>{ const e=cur(); if(e) showDetail(e); });
|
||||
|
||||
Reference in New Issue
Block a user