-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request 'add follow buttons in people search results' (#71…
…5) from w3irdrobot/snort:follow-buttons-people-search into main Reviewed-on: https://git.v0l.io/Kieran/snort/pulls/715
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { useCallback, useMemo } from "react"; | ||
import { TaggedNostrEvent } from "@snort/system"; | ||
|
||
import useTimelineFeed, { TimelineFeed } from "@/Feed/TimelineFeed"; | ||
import FollowListBase from "@/Element/User/FollowListBase"; | ||
import PageSpinner from "@/Element/PageSpinner"; | ||
import useModeration from "@/Hooks/useModeration"; | ||
|
||
export default function UsersFeed({ keyword, sortPopular = true }: { keyword: string; sortPopular?: boolean }) { | ||
const feed: TimelineFeed = useTimelineFeed( | ||
{ | ||
type: "profile_keyword", | ||
items: [keyword + (sortPopular ? " sort:popular" : "")], | ||
discriminator: keyword, | ||
}, | ||
{ method: "LIMIT_UNTIL" }, | ||
); | ||
|
||
const { muted, isEventMuted } = useModeration(); | ||
const filterPosts = useCallback( | ||
(nts: readonly TaggedNostrEvent[]) => { | ||
return nts.filter(a => !isEventMuted(a)); | ||
}, | ||
[muted], | ||
); | ||
const usersFeed = useMemo(() => filterPosts(feed.main ?? []).map(p => p.pubkey), [feed, filterPosts]); | ||
|
||
if (!usersFeed) return <PageSpinner />; | ||
|
||
return <FollowListBase pubkeys={usersFeed} showAbout={true} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters