Adding red dot indicator feature, got main components done

This commit is contained in:
Eshwar Tangirala
2025-05-15 20:19:05 -04:00
parent d6910aa1e8
commit 3f2f6e83fa
4 changed files with 26 additions and 14 deletions

View File

@@ -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) => {

View File

@@ -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
}