completionId: cgen-2ff0a0db7d5f46089d624e3b5300939c
cgen-2ff0a0db7d5f46089d624e3b5300939c
This commit is contained in:
parent
07e423e608
commit
b42cf8b7fc
1 changed files with 6 additions and 4 deletions
|
|
@ -299,19 +299,21 @@ export default function Feed() {
|
|||
}, [fetchFeed]);
|
||||
|
||||
const filteredItems = useMemo(() => {
|
||||
let filtered = items.filter((item) => selectedArms.includes(item.arm || "labs"));
|
||||
|
||||
if (activeFilter === "following") {
|
||||
return items.filter(
|
||||
filtered = filtered.filter(
|
||||
(item) =>
|
||||
isFollowingAuthor(item.authorId) || item.authorId === user?.id,
|
||||
);
|
||||
}
|
||||
if (activeFilter === "trending") {
|
||||
return [...items].sort(
|
||||
filtered = [...filtered].sort(
|
||||
(a, b) => b.likes + b.comments - (a.likes + a.comments),
|
||||
);
|
||||
}
|
||||
return items;
|
||||
}, [activeFilter, isFollowingAuthor, items, user?.id]);
|
||||
return filtered;
|
||||
}, [activeFilter, isFollowingAuthor, items, selectedArms, user?.id]);
|
||||
|
||||
const trendingTopics = useMemo<TrendingTopic[]>(() => {
|
||||
const counts = new Map<string, number>();
|
||||
|
|
|
|||
Loading…
Reference in a new issue