Skip to content

Add feature to Group starred Items per Feed #3148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f0e05b4
Add feature to Group starred Items per Feed
Juri-w Apr 20, 2025
66b6c43
Fix lint errors
Juri-w Apr 21, 2025
c302823
Remove storing route
Juri-w Apr 21, 2025
b7077e5
change to count prop
Juri-w Apr 21, 2025
38ee0b0
Add right count on top
Juri-w Apr 21, 2025
7e5aa0b
Add Changelog
Juri-w Apr 21, 2025
5a6bf75
correct to existing val
Juri-w Apr 21, 2025
b09b1b1
solve scrollbar not resetting
Juri-w Apr 21, 2025
6e640f2
correct back to lf
Juri-w Apr 27, 2025
524dd19
add items fetcher per starred feed
Juri-w Apr 27, 2025
d81b459
add backend get by feed id filter
Juri-w Apr 27, 2025
cce5858
add starredcount by feed getter
Juri-w Apr 27, 2025
ef6768e
change to filter where starred items not 0
Juri-w Apr 28, 2025
7cd8ad5
fix linters
Juri-w Apr 28, 2025
0c09771
move to unreleased
Juri-w May 3, 2025
721c9f6
chnage to feedId
Juri-w May 3, 2025
3f7f5a0
change parm order
Juri-w May 3, 2025
d032c03
remove template
Juri-w May 3, 2025
2dbb27f
remove not existing initial route
Juri-w May 3, 2025
d71569b
fix refetch
Juri-w May 5, 2025
c0fef5b
fix exact, change route
Juri-w May 5, 2025
fd2af99
fix lint
Juri-w May 5, 2025
fd83148
remove unnessesary create
Juri-w May 5, 2025
199c972
fix test
Juri-w May 5, 2025
a047aaf
remove mutations lint
Juri-w May 5, 2025
f75bdd4
update feed starred count
Juri-w May 5, 2025
4cac8d8
Merge branch 'master' into master
Juri-w May 5, 2025
1781bd4
fix update starred count linter
Juri-w May 5, 2025
1dca09b
Merge branch 'master' of https://github.com/Juri-w/news
Juri-w May 5, 2025
2d9a77b
fix findAllItems Tests
Juri-w May 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The format is mostly based on [Keep a Changelog](https://keepachangelog.com/en/1

You can also check [on GitHub](https://github.com/nextcloud/news/releases), the release notes there are generated automatically and include every pull request.

# Unreleased
### Changed
- Add feature to Group starred Items per Feed

# Unreleased
## [26.x.x]
### Changed
Expand Down
40 changes: 39 additions & 1 deletion src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,26 @@
<RssIcon />
</template>
</NcAppNavigationItem>
<NcAppNavigationItem :name="t('news', 'Starred')" icon="icon-starred" :to="{ name: ROUTES.STARRED }">
<NcAppNavigationItem :name="t('news', 'Starred')"
icon="icon-starred"
:to="{ name: ROUTES.STARRED }"
:allow-collapse="true"
:force-menu="true">
<template v-for="(group) in GroupedStars">
<NcAppNavigationItem :key="group.feed.name"
:ref="'starredfeed-' + group.feed.id"
:name="group.feed.title"
:icon="''"
:to="{ name: ROUTES.STARREDFEED, params: { feedId: group.feed.id.toString() } }">
<template #icon>
<RssIcon v-if="!group.feed.faviconLink" />
<span v-if="group.feed.faviconLink" style="width: 16px; height: 16px; background-size: contain;" :style="{ 'backgroundImage': 'url(' + group.feed.faviconLink + ')' }" />
</template>
<template #counter>
<NcCounterBubble :count="group.items.length" />
</template>
</NcAppNavigationItem>
</template>
<template #counter>
<NcCounterBubble :count="items.starredCount" />
</template>
Expand Down Expand Up @@ -283,6 +302,7 @@ import HelpModal from './modals/HelpModal.vue'
import FeedInfoTable from './modals/FeedInfoTable.vue'
import { Folder } from '../types/Folder'
import { Feed } from '../types/Feed'
import { FeedItem } from '../types/FeedItem'

export default Vue.extend({
components: {
Expand Down Expand Up @@ -371,6 +391,24 @@ export default Vue.extend({

return navItems
},
GroupedStars(): Array<FeedItem> {
const GroupedStars = this.$store.getters.starred.reduce((groups, item: FeedItem) => {
const groupKey = item.feedId
if (!groups[groupKey]) {
let feed: Feed = this.$store.getters.feeds.find((feed: Feed) => feed.id === groupKey)
if (feed === undefined) {
feed = {
id: groupKey,
title: t('news', 'Unknown feed'),
}
}
groups[groupKey] = { items: [], feed }
}
groups[groupKey].items.push(item)
return groups
}, {})
return Object.values(GroupedStars)
},
loading: {
get() {
return this.$store.getters.loading
Expand Down
12 changes: 11 additions & 1 deletion src/components/routes/Starred.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@load-more="fetchMore()">
<template #header>
{{ t('news', 'Starred') }}
<NcCounterBubble class="counter-bubble" :count="items.starredCount" />
<NcCounterBubble class="counter-bubble" :count="feedId ? starred.length : items.starredCount" />
</template>
</ContentTemplate>
</template>
Expand All @@ -25,9 +25,19 @@ export default Vue.extend({
ContentTemplate,
NcCounterBubble,
},
props: {
feedId: {
type: String,
required: false,
default: undefined,
},
},
computed: {
...mapState(['items']),
starred(): FeedItem[] {
if (this.feedId) {
return this.$store.getters.starred.filter((item: FeedItem) => item.feedId === Number(this.feedId))
}
return this.$store.getters.starred
},
},
Expand Down
7 changes: 7 additions & 0 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import store from './../store/app'
export const ROUTES = {
EXPLORE: 'explore',
STARRED: 'starred',
STARREDFEED: 'starredfeed',
UNREAD: 'unread',
FEED: 'feed',
FOLDER: 'folder',
Expand Down Expand Up @@ -65,6 +66,12 @@ const routes = [
component: StarredPanel,
props: true,
},
{
name: ROUTES.STARREDFEED,
path: '/starredfeeds/:feedId',
component: StarredPanel,
props: true,
},
{
name: ROUTES.UNREAD,
path: '/unread',
Expand Down