mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 14:44:26 +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:
@@ -6,6 +6,7 @@ import { ReadableContent } from '../services/readerService'
|
||||
import { eventManager } from '../services/eventManager'
|
||||
import { fetchProfiles } from '../services/profileService'
|
||||
import { useDocumentTitle } from './useDocumentTitle'
|
||||
import { getNpubFallbackDisplay } from '../utils/nostrUriResolver'
|
||||
|
||||
interface UseEventLoaderProps {
|
||||
eventId?: string
|
||||
@@ -40,7 +41,7 @@ export function useEventLoader({
|
||||
// Initial title
|
||||
let title = `Note (${event.kind})`
|
||||
if (event.kind === 1) {
|
||||
title = `Note by @${event.pubkey.slice(0, 8)}...`
|
||||
title = `Note by ${getNpubFallbackDisplay(event.pubkey)}`
|
||||
}
|
||||
|
||||
// Emit immediately
|
||||
@@ -83,7 +84,7 @@ export function useEventLoader({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (resolved) {
|
||||
const updatedTitle = `Note by @${resolved}`
|
||||
setCurrentTitle(updatedTitle)
|
||||
|
||||
Reference in New Issue
Block a user