counter on feed select

This commit is contained in:
2026-07-13 17:46:49 +02:00
parent 671ed86b48
commit a898e7ac33
4 changed files with 30 additions and 5 deletions
+12
View File
@@ -22,6 +22,17 @@ const feedTitles = computed(() => {
if (feedFilter.value) titles.add(feedFilter.value)
return [...titles].sort((a, b) => a.localeCompare(b))
})
// Unread count per feed title, shown next to each option in the filter
// <select>. Derived from the master (allItems) so article view's
// read-but-still-shown items are excluded. A title kept in feedTitles with no
// unread items left has no key here — render it as 0.
const feedUnreadCounts = computed(() => {
const counts = {}
for (const item of allItems.value) {
if (!item.read) counts[item.feedTitle] = (counts[item.feedTitle] ?? 0) + 1
}
return counts
})
// The header badge count: unread items in the selected feed when a filter is
// active, otherwise the global unread total. Derived from the master (allItems)
// rather than the displayed `feeds` so article view's read-but-still-shown
@@ -466,6 +477,7 @@ export function useFeeds() {
allItems,
feedFilter,
feedTitles,
feedUnreadCounts,
unreadCount,
setFeedFilter,
showMessage,