From dd8825e3923f8ada6d2c155108652bdf8d3946ee Mon Sep 17 00:00:00 2001 From: Guido X Jansen Date: Thu, 5 Mar 2026 23:30:56 +0100 Subject: [PATCH] fix(topics): show pinned topics in dedicated section on homepage (#185) * chore: add .claude/worktrees to gitignore * fix(topics): show pinned topics in dedicated section on homepage Pinned topics appeared in both Recent and Popular lists. Extract them into a single deduplicated "Pinned Topics" section at the top and filter them out of the other two lists. --- src/app/page.tsx | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index fdc509c..302f934 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -97,15 +97,40 @@ export default async function HomePage() { )} - {/* Recent Topics */} - + {/* Pinned Topics — deduplicated from both feeds, shown once at top */} + {(() => { + const pinnedMap = new Map() + for (const t of [...recentTopics.topics, ...popularTopics.topics]) { + if (t.isPinned && !pinnedMap.has(t.uri)) { + pinnedMap.set(t.uri, t) + } + } + const pinnedTopics = [...pinnedMap.values()] + const recentFiltered = recentTopics.topics.filter((t) => !t.isPinned) + const popularFiltered = popularTopics.topics.filter((t) => !t.isPinned) - {/* Popular Topics */} - {popularTopics.topics.length > 0 && ( -
- -
- )} + return ( + <> + {pinnedTopics.length > 0 && ( + + )} + + {/* Recent Topics */} + {recentFiltered.length > 0 && ( +
0 ? 'mt-8' : undefined}> + +
+ )} + + {/* Popular Topics */} + {popularFiltered.length > 0 && ( +
+ +
+ )} + + ) + })()} )} -- 2.51.2