mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
Adding red dot indicator feature, got main components done
This commit is contained in:
@@ -43,6 +43,20 @@ export const treeSlice = createSlice({
|
||||
},
|
||||
extraReducers: builder => {
|
||||
builder.addCase(reloadTree.fulfilled, (state, action) => {
|
||||
visitCategoryTree(action.payload, category => {
|
||||
category.feeds = category.feeds.map(feed => {
|
||||
const storageKey = `feed-${feed.id}-unread`
|
||||
const prevUnread = parseInt(localStorage.getItem(storageKey) || "0", 10)
|
||||
const hasNewEntries = feed.unread > prevUnread
|
||||
|
||||
localStorage.setItem(storageKey, feed.unread.toString())
|
||||
|
||||
return {
|
||||
...feed,
|
||||
hasNewEntries
|
||||
}
|
||||
})
|
||||
})
|
||||
state.rootCategory = action.payload
|
||||
})
|
||||
builder.addCase(collapseTreeCategory.pending, (state, action) => {
|
||||
|
||||
@@ -30,13 +30,17 @@ export interface Subscription {
|
||||
filter?: string
|
||||
}
|
||||
|
||||
export interface TreeSubscription extends Subscription {
|
||||
hasNewEntries?: boolean
|
||||
}
|
||||
|
||||
export interface Category {
|
||||
id: string
|
||||
parentId?: string
|
||||
parentName?: string
|
||||
name: string
|
||||
children: Category[]
|
||||
feeds: Subscription[]
|
||||
feeds: TreeSubscription[]
|
||||
expanded: boolean
|
||||
position: number
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user