feat: support configurable trust score threshold per context
This commit is contained in:
parent
28a1b3096a
commit
ca9610b711
46 changed files with 350 additions and 122 deletions
|
|
@ -2,12 +2,20 @@ import NormalFeed from '@/components/NormalFeed'
|
|||
import { checkAlgoRelay } from '@/lib/relay'
|
||||
import { useFeed } from '@/providers/FeedProvider'
|
||||
import relayInfoService from '@/services/relay-info.service'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
export default function RelaysFeed() {
|
||||
const { relayUrls } = useFeed()
|
||||
const { relayUrls, feedInfo } = useFeed()
|
||||
const [isReady, setIsReady] = useState(false)
|
||||
const [areAlgoRelays, setAreAlgoRelays] = useState(false)
|
||||
const trustScoreFilterId = useMemo(() => {
|
||||
if (feedInfo?.feedType === 'relay' && feedInfo.id) {
|
||||
return `relay-${feedInfo.id}`
|
||||
} else if (feedInfo?.feedType === 'relays' && feedInfo.id) {
|
||||
return `relays-${feedInfo.id}`
|
||||
}
|
||||
return 'relays-default'
|
||||
}, [feedInfo])
|
||||
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
|
|
@ -24,6 +32,7 @@ export default function RelaysFeed() {
|
|||
|
||||
return (
|
||||
<NormalFeed
|
||||
trustScoreFilterId={trustScoreFilterId}
|
||||
subRequests={[{ urls: relayUrls, filter: {} }]}
|
||||
areAlgoRelays={areAlgoRelays}
|
||||
isMainFeed
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import NotificationList from '@/components/NotificationList'
|
||||
import TrustScoreFilter from '@/components/TrustScoreFilter'
|
||||
import { SPECIAL_TRUST_SCORE_FILTER_ID } from '@/constants'
|
||||
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout'
|
||||
import { usePrimaryPage } from '@/PageManager'
|
||||
import { TPageRef } from '@/types'
|
||||
|
|
@ -42,7 +43,7 @@ function NotificationListPageTitlebar() {
|
|||
<Bell />
|
||||
<div className="text-lg font-semibold">{t('Notifications')}</div>
|
||||
</div>
|
||||
<TrustScoreFilter />
|
||||
<TrustScoreFilter filterId={SPECIAL_TRUST_SCORE_FILTER_ID.NOTIFICATIONS} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue