diff --git a/src/components/Bookmarks.tsx b/src/components/Bookmarks.tsx index 3587a4f7..afe65b9a 100644 --- a/src/components/Bookmarks.tsx +++ b/src/components/Bookmarks.tsx @@ -141,6 +141,7 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { onToggleUnderlines={setShowUnderlines} selectedHighlightId={selectedHighlightId} onRefresh={handleFetchHighlights} + onHighlightClick={setSelectedHighlightId} /> diff --git a/src/components/HighlightItem.tsx b/src/components/HighlightItem.tsx index 5fe3bee9..8feaeee2 100644 --- a/src/components/HighlightItem.tsx +++ b/src/components/HighlightItem.tsx @@ -8,9 +8,10 @@ interface HighlightItemProps { highlight: Highlight onSelectUrl?: (url: string) => void isSelected?: boolean + onHighlightClick?: (highlightId: string) => void } -export const HighlightItem: React.FC = ({ highlight, onSelectUrl, isSelected }) => { +export const HighlightItem: React.FC = ({ highlight, onSelectUrl, isSelected, onHighlightClick }) => { const itemRef = useRef(null) useEffect(() => { @@ -18,6 +19,13 @@ export const HighlightItem: React.FC = ({ highlight, onSelec itemRef.current.scrollIntoView({ behavior: 'smooth', block: 'center' }) } }, [isSelected]) + + const handleItemClick = () => { + if (onHighlightClick) { + onHighlightClick(highlight.id) + } + } + const handleLinkClick = (url: string, e: React.MouseEvent) => { if (onSelectUrl) { e.preventDefault() @@ -35,7 +43,13 @@ export const HighlightItem: React.FC = ({ highlight, onSelec const sourceLink = getSourceLink() return ( -
+
diff --git a/src/components/HighlightsPanel.tsx b/src/components/HighlightsPanel.tsx index fb937877..06255c22 100644 --- a/src/components/HighlightsPanel.tsx +++ b/src/components/HighlightsPanel.tsx @@ -14,6 +14,7 @@ interface HighlightsPanelProps { onToggleUnderlines?: (show: boolean) => void selectedHighlightId?: string onRefresh?: () => void + onHighlightClick?: (highlightId: string) => void } export const HighlightsPanel: React.FC = ({ @@ -25,7 +26,8 @@ export const HighlightsPanel: React.FC = ({ selectedUrl, onToggleUnderlines, selectedHighlightId, - onRefresh + onRefresh, + onHighlightClick }) => { const [showUnderlines, setShowUnderlines] = useState(true) @@ -140,6 +142,7 @@ export const HighlightsPanel: React.FC = ({ highlight={highlight} onSelectUrl={onSelectUrl} isSelected={highlight.id === selectedHighlightId} + onHighlightClick={onHighlightClick} /> ))}