diff --git a/src/components/BookmarkItem.tsx b/src/components/BookmarkItem.tsx index 1824a2b3..33b37707 100644 --- a/src/components/BookmarkItem.tsx +++ b/src/components/BookmarkItem.tsx @@ -22,6 +22,8 @@ import { faEyeSlash, faThumbtack } from '@fortawesome/free-solid-svg-icons' +import { useEventModel } from 'applesauce-react/hooks' +import { Models } from 'applesauce-core' import { IndividualBookmark } from '../types/bookmarks' import { formatDate, renderParsedContent } from '../utils/bookmarkUtils' import { extractUrlsFromContent } from '../services/bookmarkHelpers' @@ -47,6 +49,17 @@ export const BookmarkItem: React.FC = ({ bookmark, index, onS const extractedUrls = extractUrlsFromContent(bookmark.content) const hasUrls = extractedUrls.length > 0 + // Resolve author profile using applesauce + const authorProfile = useEventModel(Models.ProfileModel, [bookmark.pubkey]) + + // Get display name for author + const getAuthorDisplayName = () => { + if (authorProfile?.name) return authorProfile.name + if (authorProfile?.display_name) return authorProfile.display_name + if (authorProfile?.nip05) return authorProfile.nip05 + return short(bookmark.pubkey) // fallback to short pubkey + } + // Map kind numbers to FontAwesome icons const getKindIcon = (kind: number) => { const iconMap: Record = { @@ -139,7 +152,7 @@ export const BookmarkItem: React.FC = ({ bookmark, index, onS - Author: {short(bookmark.pubkey)} + Author: {getAuthorDisplayName()}