mirror of
https://github.com/dergigi/boris.git
synced 2025-12-24 01:54:19 +01:00
fix: merge reading progress from controller into reads/links before filtering
- Enrich reads and links arrays with reading progress from readingProgressMap - Use item.id to lookup progress for articles - Use item.url to lookup progress for links - Now 'started' and 'reading' filters show correct articles - Filters respond in real-time as reading progress updates from controller
This commit is contained in:
@@ -499,9 +499,30 @@ const Me: React.FC<MeProps> = ({
|
||||
|
||||
const groups = groupIndividualBookmarks(filteredBookmarks)
|
||||
|
||||
// Enrich reads and links with reading progress from controller
|
||||
const readsWithProgress = reads.map(item => {
|
||||
if (item.type === 'article' && item.author) {
|
||||
const progress = readingProgressMap.get(item.id)
|
||||
if (progress !== undefined) {
|
||||
return { ...item, readingProgress: progress }
|
||||
}
|
||||
}
|
||||
return item
|
||||
})
|
||||
|
||||
const linksWithProgress = links.map(item => {
|
||||
if (item.url) {
|
||||
const progress = readingProgressMap.get(item.url)
|
||||
if (progress !== undefined) {
|
||||
return { ...item, readingProgress: progress }
|
||||
}
|
||||
}
|
||||
return item
|
||||
})
|
||||
|
||||
// Apply reading progress filter
|
||||
const filteredReads = filterByReadingProgress(reads, readingProgressFilter, highlights)
|
||||
const filteredLinks = filterByReadingProgress(links, readingProgressFilter, highlights)
|
||||
const filteredReads = filterByReadingProgress(readsWithProgress, readingProgressFilter, highlights)
|
||||
const filteredLinks = filterByReadingProgress(linksWithProgress, readingProgressFilter, highlights)
|
||||
const sections: Array<{ key: string; title: string; items: IndividualBookmark[] }> =
|
||||
groupingMode === 'flat'
|
||||
? [{ key: 'all', title: `All Bookmarks (${filteredBookmarks.length})`, items: filteredBookmarks }]
|
||||
|
||||
Reference in New Issue
Block a user