mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 07:04:19 +01:00
refactor: standardize profile display name fallbacks across codebase
- Add getProfileDisplayName() utility function for consistent profile name resolution - Update all components to use standardized npub fallback format instead of hex - Fix useProfileLabels hook to include fallback npub labels when profiles lack names - Refactor NostrMentionLink to eliminate duplication between npub/nprofile cases - Remove debug console.log statements from RichContent component - Update AuthorCard, SidebarHeader, HighlightItem, Support, BlogPostCard, ResolvedMention, and useEventLoader to use new utilities
This commit is contained in:
@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'
|
||||
import { useEventModel } from 'applesauce-react/hooks'
|
||||
import { Models, Helpers } from 'applesauce-core'
|
||||
import { decode, npubEncode } from 'nostr-tools/nip19'
|
||||
import { getNpubFallbackDisplay } from '../utils/nostrUriResolver'
|
||||
import { getProfileDisplayName } from '../utils/nostrUriResolver'
|
||||
|
||||
const { getPubkeyFromDecodeResult } = Helpers
|
||||
|
||||
@@ -21,7 +21,7 @@ const ResolvedMention: React.FC<ResolvedMentionProps> = ({ encoded }) => {
|
||||
}
|
||||
|
||||
const profile = pubkey ? useEventModel(Models.ProfileModel, [pubkey]) : undefined
|
||||
const display = profile?.name || profile?.display_name || profile?.nip05 || (pubkey ? getNpubFallbackDisplay(pubkey) : encoded)
|
||||
const display = pubkey ? getProfileDisplayName(profile, pubkey) : encoded
|
||||
const npub = pubkey ? npubEncode(pubkey) : undefined
|
||||
|
||||
if (npub) {
|
||||
|
||||
Reference in New Issue
Block a user