Barazo default frontend barazo.forum
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

authored by

Guido X Jansen and committed by
GitHub
dd8825e3 eccb916f

+33 -8
+33 -8
src/app/page.tsx
··· 97 97 </div> 98 98 )} 99 99 100 - {/* Recent Topics */} 101 - <TopicList topics={recentTopics.topics} heading="Recent Topics" /> 100 + {/* Pinned Topics — deduplicated from both feeds, shown once at top */} 101 + {(() => { 102 + const pinnedMap = new Map<string, (typeof recentTopics.topics)[number]>() 103 + for (const t of [...recentTopics.topics, ...popularTopics.topics]) { 104 + if (t.isPinned && !pinnedMap.has(t.uri)) { 105 + pinnedMap.set(t.uri, t) 106 + } 107 + } 108 + const pinnedTopics = [...pinnedMap.values()] 109 + const recentFiltered = recentTopics.topics.filter((t) => !t.isPinned) 110 + const popularFiltered = popularTopics.topics.filter((t) => !t.isPinned) 111 + 112 + return ( 113 + <> 114 + {pinnedTopics.length > 0 && ( 115 + <TopicList topics={pinnedTopics} heading="Pinned Topics" /> 116 + )} 117 + 118 + {/* Recent Topics */} 119 + {recentFiltered.length > 0 && ( 120 + <div className={pinnedTopics.length > 0 ? 'mt-8' : undefined}> 121 + <TopicList topics={recentFiltered} heading="Recent Topics" /> 122 + </div> 123 + )} 102 124 103 - {/* Popular Topics */} 104 - {popularTopics.topics.length > 0 && ( 105 - <div className="mt-8"> 106 - <TopicList topics={popularTopics.topics} heading="Popular Topics" /> 107 - </div> 108 - )} 125 + {/* Popular Topics */} 126 + {popularFiltered.length > 0 && ( 127 + <div className="mt-8"> 128 + <TopicList topics={popularFiltered} heading="Popular Topics" /> 129 + </div> 130 + )} 131 + </> 132 + ) 133 + })()} 109 134 </> 110 135 )} 111 136 </ForumLayout>