Show the recent strip only where it is not a duplicate

The strip is the head of the same updated_at DESC reading list the All tab
renders, and app.html put it on every tab: on a small library it repeated the
list immediately below it while eating ~230px of the first phone screen, and on
Archived and Finished it showed reading series above the opposite bucket.

buildListView now fills Recent only for tab=all with more reading series than
the strip holds. Because the strip lives outside the htmx-swapped #list, an
in-page tab switch cannot re-render it, so applyFilter also decides its
visibility from the active tab; setActiveTab pokes it after a swap.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-30 19:10:42 +07:00
parent 07b075f04a
commit c560a61a9a
3 changed files with 64 additions and 20 deletions
+11 -4
View File
@@ -14,11 +14,14 @@
if (!card.hidden) visible++;
});
// The strip is never filtered, so leaving it up during a search puts
// non-matching covers above an empty list and the screen contradicts
// itself.
// The strip is All-only and never filtered. It lives outside #list, so an
// htmx tab switch does not re-render it and this is what takes it down;
// leaving it up during a search would also put non-matching covers above
// an empty list.
var recent = document.querySelector(".recent");
if (recent) recent.hidden = needle !== "";
if (recent) {
recent.hidden = needle !== "" || !document.querySelector('.tabs a.active[href="/?tab=all"]');
}
// An empty bucket already explains itself server-side; this only speaks
// when the filter is what emptied the screen.
@@ -43,6 +46,7 @@
// htmx replaces the list on a tab switch, so re-apply to the new cards.
document.body.addEventListener("htmx:afterSwap", applyFilter);
document.addEventListener("mangabm:refilter", applyFilter);
})();
function setActiveTab(el) {
@@ -52,6 +56,9 @@ function setActiveTab(el) {
if (on) t.setAttribute("aria-current", "page");
else t.removeAttribute("aria-current");
});
// The strip is outside the swapped region, so its visibility is re-decided
// here rather than by the server that just answered.
document.dispatchEvent(new Event("mangabm:refilter"));
}
// The chapter-edit form and the archive/finish/remove confirm rows are the