diff --git a/src/components/HighlightItem.tsx b/src/components/HighlightItem.tsx index 752e38e1..a6022daa 100644 --- a/src/components/HighlightItem.tsx +++ b/src/components/HighlightItem.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faQuoteLeft, faExternalLinkAlt, faPlane, faSpinner, faHighlighter, faTrash, faEllipsisH, faMobileAlt } from '@fortawesome/free-solid-svg-icons' +import { faQuoteLeft, faExternalLinkAlt, faPlane, faSpinner, faHighlighter, faTrash, faEllipsisH, faMobileAlt, faUser } from '@fortawesome/free-solid-svg-icons' import { faComments } from '@fortawesome/free-regular-svg-icons' import { Highlight } from '../types/highlights' import { useEventModel } from 'applesauce-react/hooks' @@ -460,6 +460,28 @@ export const HighlightItem: React.FC = ({ handleConfirmDelete() } + // Navigate to author's profile + const navigateToProfile = (tab?: 'highlights' | 'writings') => { + try { + const npub = nip19.npubEncode(highlight.pubkey) + const path = tab === 'writings' ? `/p/${npub}/writings` : `/p/${npub}` + navigate(path) + } catch (err) { + console.error('Failed to encode npub for profile navigation:', err) + } + } + + const handleAuthorClick = (e: React.MouseEvent) => { + e.stopPropagation() + navigateToProfile() + } + + const handleMenuViewProfile = (e: React.MouseEvent) => { + e.stopPropagation() + setShowMenu(false) + navigateToProfile() + } + return ( <>
= ({ /> )} - + {getUserDisplayName()} - +
@@ -591,6 +617,13 @@ export const HighlightItem: React.FC = ({ {showMenu && (
+