From 5c2c8f618cf488ff12171153d3039e3f399e9369 Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 5 Oct 2025 03:02:56 +0100 Subject: [PATCH] feat: auto-open highlights panel when clicking highlight in article - Add handleHighlightClick that opens panel if collapsed - Sets selected highlight ID to scroll to it in the panel - Add console logging for debugging - When user clicks highlight in article with panel closed, panel opens automatically --- src/components/Bookmarks.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/Bookmarks.tsx b/src/components/Bookmarks.tsx index 93778306..80cd02a4 100644 --- a/src/components/Bookmarks.tsx +++ b/src/components/Bookmarks.tsx @@ -157,6 +157,16 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { } } + const handleHighlightClick = (highlightId: string) => { + console.log('Highlight clicked:', highlightId) + setSelectedHighlightId(highlightId) + // Open highlights panel if it's collapsed + if (isHighlightsCollapsed) { + console.log('Opening highlights panel') + setIsHighlightsCollapsed(false) + } + } + if (loading) { @@ -204,7 +214,7 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { selectedUrl={selectedUrl} highlights={highlights} showUnderlines={showUnderlines} - onHighlightClick={setSelectedHighlightId} + onHighlightClick={handleHighlightClick} selectedHighlightId={selectedHighlightId} /> )} @@ -220,7 +230,7 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { onToggleUnderlines={setShowUnderlines} selectedHighlightId={selectedHighlightId} onRefresh={handleFetchHighlights} - onHighlightClick={setSelectedHighlightId} + onHighlightClick={handleHighlightClick} />