feat: outbox model for the following feed

This commit is contained in:
codytseng
2025-03-27 22:37:06 +08:00
parent df4eb10802
commit d24e208f0b
22 changed files with 642 additions and 517 deletions

View File

@@ -1,16 +1,12 @@
import NoteList from '@/components/NoteList'
import { SEARCHABLE_RELAY_URLS } from '@/constants'
import { useFetchRelayInfos } from '@/hooks'
import { BIG_RELAY_URLS, SEARCHABLE_RELAY_URLS } from '@/constants'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { useFeed } from '@/providers/FeedProvider'
import { Filter } from 'nostr-tools'
import { forwardRef, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
const NoteListPage = forwardRef(({ index }: { index?: number }, ref) => {
const { t } = useTranslation()
const { relayUrls } = useFeed()
const { searchableRelayUrls } = useFetchRelayInfos(relayUrls)
const {
title = '',
filter,
@@ -26,7 +22,7 @@ const NoteListPage = forwardRef(({ index }: { index?: number }, ref) => {
return {
title: `# ${hashtag}`,
filter: { '#t': [hashtag] },
urls: relayUrls,
urls: BIG_RELAY_URLS,
type: 'hashtag'
}
}
@@ -35,12 +31,12 @@ const NoteListPage = forwardRef(({ index }: { index?: number }, ref) => {
return {
title: `${t('Search')}: ${search}`,
filter: { search },
urls: searchableRelayUrls.concat(SEARCHABLE_RELAY_URLS).slice(0, 4),
urls: SEARCHABLE_RELAY_URLS,
type: 'search'
}
}
return { urls: relayUrls }
}, [JSON.stringify(relayUrls)])
return { urls: BIG_RELAY_URLS }
}, [])
return (
<SecondaryPageLayout ref={ref} index={index} title={title} displayScrollToTopButton>

View File

@@ -11,12 +11,10 @@ import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import { Button } from '@/components/ui/button'
import { Skeleton } from '@/components/ui/skeleton'
import { useFetchFollowings, useFetchProfile } from '@/hooks'
import { useFetchRelayList } from '@/hooks/useFetchRelayList'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { toMuteList, toProfileEditor } from '@/lib/link'
import { generateImageByPubkey } from '@/lib/pubkey'
import { SecondaryPageLink, useSecondaryPage } from '@/PageManager'
import { useFeed } from '@/providers/FeedProvider'
import { useMuteList } from '@/providers/MuteListProvider'
import { useNostr } from '@/providers/NostrProvider'
import { Link, Zap } from 'lucide-react'
@@ -30,15 +28,6 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
const { t } = useTranslation()
const { push } = useSecondaryPage()
const { profile, isFetching } = useFetchProfile(id)
const { relayList, isFetching: isFetchingRelayInfo } = useFetchRelayList(profile?.pubkey)
const { relayUrls: currentRelayUrls } = useFeed()
const relayUrls = useMemo(
() =>
relayList.write.length < 4
? relayList.write.concat(currentRelayUrls).slice(0, 4)
: relayList.write.slice(0, 8),
[relayList, currentRelayUrls]
)
const { pubkey: accountPubkey } = useNostr()
const { mutePubkeys } = useMuteList()
const { followings } = useFetchFollowings(profile?.pubkey)
@@ -152,14 +141,7 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
</div>
</div>
</div>
{!isFetchingRelayInfo && (
<NoteList
filter={{ authors: [pubkey] }}
relayUrls={relayUrls}
className="mt-2"
filterMutedNotes={false}
/>
)}
<NoteList filter={{ authors: [pubkey] }} className="mt-2" filterMutedNotes={false} />
</SecondaryPageLayout>
)
})