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
This commit is contained in:
Gigi
2025-10-05 03:02:56 +01:00
parent 726b8a9c10
commit 5c2c8f618c

View File

@@ -157,6 +157,16 @@ const Bookmarks: React.FC<BookmarksProps> = ({ 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<BookmarksProps> = ({ relayPool, onLogout }) => {
selectedUrl={selectedUrl}
highlights={highlights}
showUnderlines={showUnderlines}
onHighlightClick={setSelectedHighlightId}
onHighlightClick={handleHighlightClick}
selectedHighlightId={selectedHighlightId}
/>
)}
@@ -220,7 +230,7 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
onToggleUnderlines={setShowUnderlines}
selectedHighlightId={selectedHighlightId}
onRefresh={handleFetchHighlights}
onHighlightClick={setSelectedHighlightId}
onHighlightClick={handleHighlightClick}
/>
</div>
</div>