Update item counts on all feeds
This commit is contained in:
parent
63777e0db2
commit
ef79ee4997
@ -42,8 +42,8 @@
|
||||
All ({{unread}})
|
||||
</div>
|
||||
|
||||
<div v-for="feed in feeds" :class="{strong: unreadCount(feed), 'alert': true, 'alert-success': selectedFeed == feed.FeedURL }" :data-feed="feed.FeedURL" v-on:click="loadFeed(feed.ID)">
|
||||
{{feed.Title}} ({{unreadCount(feed)}})
|
||||
<div v-for="feed in feeds" :class="{strong: unreadCounts[feed.ID], 'alert': true, 'alert-success': selectedFeed == feed.FeedURL }" :data-feed="feed.FeedURL" v-on:click="loadFeed(feed.ID)">
|
||||
{{feed.Title}} ({{unreadCounts[feed.ID]}})
|
||||
</div>
|
||||
|
||||
<div class="menu">
|
||||
@ -124,6 +124,13 @@
|
||||
},
|
||||
unread() {
|
||||
return this.items.filter(item => !item.Read).length;
|
||||
},
|
||||
unreadCounts() {
|
||||
return this.items.filter(item => !item.Read).reduce((acc, item) => {
|
||||
if (!acc[item.FeedID]) acc[item.FeedID] = 0;
|
||||
acc[item.FeedID]++;
|
||||
return acc;
|
||||
}, {})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -136,9 +143,6 @@
|
||||
document.body.classList.toggle('dark');
|
||||
document.body.classList.toggle('dark-grey');
|
||||
},
|
||||
unreadCount(feed) {
|
||||
return this.items.filter(item => item.FeedID == feed.ID).length;
|
||||
},
|
||||
loadFeed(feed) {
|
||||
this.selectedItem = undefined;
|
||||
this.selectedFeed = feed;
|
||||
|
Loading…
Reference in New Issue
Block a user