From 77c2ef1794f32b085c4d0ac57e8eec491bdffab0 Mon Sep 17 00:00:00 2001 From: Gigi Date: Mon, 20 Oct 2025 13:02:56 +0200 Subject: [PATCH] feat(links): mirror archive-only vs progress-only behavior in Links tab --- src/components/Me.tsx | 81 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 14 deletions(-) diff --git a/src/components/Me.tsx b/src/components/Me.tsx index 03b76599..9377f920 100644 --- a/src/components/Me.tsx +++ b/src/components/Me.tsx @@ -659,6 +659,40 @@ const Me: React.FC = ({ return items })() + // Archive-only list for links (URLs only), independent of reading progress + const archiveOnlyLinks: ReadItem[] = (() => { + if (readingProgressFilter !== 'archive') return [] + const markedIds = new Set([ + ...archiveController.getMarkedIds() + ]) + const items: ReadItem[] = [] + // Only consider URL marks (exclude naddr) + const markedUrls = Array.from(markedIds).filter(id => !id.startsWith('naddr1')) + const markedUrlSet = new Set(markedUrls) + // Add existing link items that are marked + for (const item of linksWithProgress) { + const id = item.url || item.id + if (id && markedUrlSet.has(id)) { + items.push({ ...item, markedAsRead: true }) + } + } + // Add any marked URLs not present yet + for (const url of markedUrlSet) { + const exists = items.find(i => (i.url || i.id) === url) + if (!exists) { + items.push({ + id: url, + source: 'marked-as-read', + type: 'external', + url, + markedAsRead: true, + readingTimestamp: Math.floor(Date.now() / 1000) + }) + } + } + return items + })() + // Debug logs for archive filter issues if (readingProgressFilter === 'archive') { const ids = Array.from(new Set([ @@ -886,21 +920,40 @@ const Me: React.FC = ({ selectedFilter={readingProgressFilter} onFilterChange={handleReadingProgressFilterChange} /> - {filteredLinks.length === 0 ? ( -
- No links match this filter. -
+ {readingProgressFilter === 'archive' ? ( + archiveOnlyLinks.length === 0 ? ( +
+ No links in archive. +
+ ) : ( +
+ {archiveOnlyLinks.map((item) => ( + + ))} +
+ ) ) : ( -
- {filteredLinks.map((item) => ( - - ))} -
+ filteredLinks.length === 0 ? ( +
+ No links match this filter. +
+ ) : ( +
+ {filteredLinks.map((item) => ( + + ))} +
+ ) )} )