feat(ui): link author to search.dergigi.com with npub\n\n- Clickable 'by: <author>' opens profile search in new tab\n- Styles for author link

This commit is contained in:
Gigi
2025-10-03 00:43:19 +02:00
parent c3eb29445e
commit d10e12b8df
2 changed files with 18 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ import {
import { faChevronDown, faChevronUp, faBookOpen } from '@fortawesome/free-solid-svg-icons'
import { useEventModel } from 'applesauce-react/hooks'
import { Models } from 'applesauce-core'
import { npubEncode } from 'nostr-tools/nip19'
import { IndividualBookmark } from '../types/bookmarks'
import { formatDate, renderParsedContent } from '../utils/bookmarkUtils'
import ContentWithResolvedProfiles from './ContentWithResolvedProfiles'
@@ -50,6 +51,7 @@ export const BookmarkItem: React.FC<BookmarkItemProps> = ({ bookmark, index, onS
// Resolve author profile using applesauce
const authorProfile = useEventModel(Models.ProfileModel, [bookmark.pubkey])
const authorNpub = npubEncode(bookmark.pubkey)
// Get display name for author
const getAuthorDisplayName = () => {
@@ -176,7 +178,15 @@ export const BookmarkItem: React.FC<BookmarkItemProps> = ({ bookmark, index, onS
<FontAwesomeIcon icon={getKindIcon(bookmark.kind)} />
</span>
<span>
by: {getAuthorDisplayName()}
<a
href={`https://search.dergigi.com/p/${authorNpub}`}
target="_blank"
rel="noopener noreferrer"
className="author-link"
title="Open author in search"
>
by: {getAuthorDisplayName()}
</a>
</span>
</div>

View File

@@ -548,6 +548,13 @@ body {
font-family: monospace;
}
.author-link {
color: #8ab4f8;
text-decoration: none;
}
.author-link:hover { text-decoration: underline; }
.kind-icon {
background: #1a1a1a;
padding: 0.25rem 0.5rem;