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); });
|
||||
|
||||
@@ -36,6 +36,8 @@ const VIEWS: Record<string,{title: string, icon: string, url?: string, blurb?: s
|
||||
blurb:'Episodes you started and have not finished, across every feed you subscribe to. Pick one up where you left off.'},
|
||||
':upnext':{title:'Up Next',icon:ICON.queue,url:'/api/queue',
|
||||
blurb:'Episodes lined up to play, in order. Each one plays when the one before it ends.'},
|
||||
// Drawn from the feed list the page already has; the address is only what marks it a place.
|
||||
':podcasts':{title:'Podcasts',icon:ICON.podcasts,url:'/api/feeds'},
|
||||
':all':{title:'All Subscriptions',icon:ICON.all},
|
||||
};
|
||||
/// Whether a feed's items are in All Subscriptions, or in Signals: not when it, or the OPML or
|
||||
|
||||
@@ -43,6 +43,8 @@ interface Feed {
|
||||
hide_from_signals: boolean;
|
||||
private: boolean;
|
||||
private_by_address: boolean;
|
||||
/** Has an audio or video file: on the Podcasts shelf (#474). */
|
||||
podcast: boolean;
|
||||
}
|
||||
|
||||
/// An item, in a page of `/api/entries` (db.rs EntryRow).
|
||||
|
||||
@@ -94,6 +94,8 @@ const ICON: Record<string,string>={
|
||||
// shape. Drawn here, so the two are the same list and differ only in that mark.
|
||||
queue:fa('0 0 512 512','<path fill="currentColor" d="M32 96a32 32 0 0 1 32-32h384a32 32 0 0 1 0 64H64a32 32 0 0 1-32-32zm0 160a32 32 0 0 1 32-32h384a32 32 0 0 1 0 64H64a32 32 0 0 1-32-32zm32 128h160a32 32 0 0 1 0 64H64a32 32 0 0 1 0-64zm320-64a32 32 0 0 1 32 32v48h48a32 32 0 0 1 0 64h-48v48a32 32 0 0 1-64 0v-48h-48a32 32 0 0 1 0-64h48v-48a32 32 0 0 1 32-32z"/>'),
|
||||
queued:fa('0 0 512 512','<path fill="currentColor" d="M32 96a32 32 0 0 1 32-32h384a32 32 0 0 1 0 64H64a32 32 0 0 1-32-32zm0 160a32 32 0 0 1 32-32h384a32 32 0 0 1 0 64H64a32 32 0 0 1-32-32zm32 128h160a32 32 0 0 1 0 64H64a32 32 0 0 1 0-64z"/><path fill="none" stroke="currentColor" stroke-width="60" stroke-linecap="round" stroke-linejoin="round" d="M300 404l54 54 116-116"/>'),
|
||||
// Font Awesome's podcast, for the Podcasts shelf (#474).
|
||||
podcasts:fa('0 0 448 512','<path fill="currentColor" d="M319.4 372c48.5-31.3 80.6-85.9 80.6-148 0-97.2-78.8-176-176-176S48 126.8 48 224c0 62.1 32.1 116.6 80.6 148 1.2 17.3 4 38 7.2 57.1l.2 1C56 395.8 0 316.5 0 224 0 100.3 100.3 0 224 0S448 100.3 448 224c0 92.5-56 171.9-136 206.1l.2-1.1c3.1-19.2 6-39.8 7.2-57zm-2.3-38.1c-1.6-5.7-3.9-11.1-7-16.2-5.8-9.7-13.5-17-21.9-22.4 19.5-17.6 31.8-43 31.8-71.3 0-53-43-96-96-96s-96 43-96 96c0 28.3 12.3 53.8 31.8 71.3-8.4 5.4-16.1 12.7-21.9 22.4-3.1 5.1-5.4 10.5-7 16.2C99.8 307.5 80 268 80 224c0-79.5 64.5-144 144-144s144 64.5 144 144c0 44-19.8 83.5-50.9 109.9zM224 312c32.9 0 64 8.6 64 43.8 0 33-12.9 104.1-20.6 132.9-5.1 19-24.5 23.4-43.4 23.4s-38.2-4.4-43.4-23.4c-7.8-28.5-20.6-99.7-20.6-132.8 0-35.1 31.1-43.8 64-43.8zm0-144a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"/>'),
|
||||
next:fa('0 0 320 512','<path fill="currentColor" d="M52.5 440.6c-9.5 7.9-22.8 9.7-34.1 4.4S0 428.4 0 416V96c0-12.4 7.2-23.7 18.4-29s24.5-3.6 34.1 4.4l192 160L256 241V96c0-17.7 14.3-32 32-32s32 14.3 32 32v320c0 17.7-14.3 32-32 32s-32-14.3-32-32V271l-11.5 9.6-192 160z"/>'),
|
||||
grip:fa('0 0 320 512','<path fill="currentColor" d="M40 352a40 40 0 1 1 0 80 40 40 0 1 1 0-80zm240 0a40 40 0 1 1 0 80 40 40 0 1 1 0-80zM40 216a40 40 0 1 1 0 80 40 40 0 1 1 0-80zm240 0a40 40 0 1 1 0 80 40 40 0 1 1 0-80zM40 80a40 40 0 1 1 0 80 40 40 0 1 1 0-80zm240 0a40 40 0 1 1 0 80 40 40 0 1 1 0-80z"/>'),
|
||||
subbed:fa('0 0 512 512','<path fill="currentColor" d="M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zM374 145.7c-10.7-7.8-25.7-5.4-33.5 5.3L221.1 315.2 169 263.1c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l72 72c5 5 11.8 7.5 18.8 7s13.4-4.1 17.5-9.8L379.3 179.2c7.8-10.7 5.4-25.7-5.3-33.5z"/>'), // solid/circle-check
|
||||
|
||||
Reference in New Issue
Block a user