diff --git a/src/components/TrustScoreBadge/index.tsx b/src/components/TrustScoreBadge/index.tsx index 86210c8..647d4ef 100644 --- a/src/components/TrustScoreBadge/index.tsx +++ b/src/components/TrustScoreBadge/index.tsx @@ -1,5 +1,6 @@ import { cn } from '@/lib/utils' import { useNostr } from '@/providers/NostrProvider' +import { useUserTrust } from '@/providers/UserTrustProvider' import trustScoreService from '@/services/trust-score.service' import { AlertTriangle, ShieldAlert } from 'lucide-react' import { useEffect, useState } from 'react' @@ -13,6 +14,7 @@ export default function TrustScoreBadge({ className?: string }) { const { t } = useTranslation() + const { isUserTrusted } = useUserTrust() const { pubkey: currentPubkey } = useNostr() const [percentile, setPercentile] = useState(null) const [loading, setLoading] = useState(true) @@ -24,6 +26,12 @@ export default function TrustScoreBadge({ return } + if (isUserTrusted(pubkey)) { + setLoading(false) + setPercentile(null) + return + } + const fetchScore = async () => { try { const data = await trustScoreService.fetchTrustScore(pubkey) @@ -38,7 +46,7 @@ export default function TrustScoreBadge({ } fetchScore() - }, [pubkey, currentPubkey]) + }, [pubkey, currentPubkey, isUserTrusted]) if (loading || percentile === null) return null