From cc311c7dc45fcebb2b10f7c68eb750a79c47c9e4 Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 5 Oct 2025 20:26:03 +0100 Subject: [PATCH] fix: classify highlights before passing to ContentPanel - Add classifiedHighlights memo in Bookmarks to ensure highlights have level property - Pass classified highlights to ContentPanel so color-coded rendering works - Reduce reader border-radius from 12px to 8px to reduce visual separation - Fixes highlights not showing with proper colors on default article --- src/components/Bookmarks.tsx | 15 ++++++++++++++- src/index.css | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/Bookmarks.tsx b/src/components/Bookmarks.tsx index 2f1c2410..981b8405 100644 --- a/src/components/Bookmarks.tsx +++ b/src/components/Bookmarks.tsx @@ -128,6 +128,19 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { } } + // Classify highlights with levels based on user context + const classifiedHighlights = useMemo(() => { + return highlights.map(h => { + let level: 'mine' | 'friends' | 'nostrverse' = 'nostrverse' + if (h.pubkey === activeAccount?.pubkey) { + level = 'mine' + } else if (followedPubkeys.has(h.pubkey)) { + level = 'friends' + } + return { ...h, level } + }) + }, [highlights, activeAccount?.pubkey, followedPubkeys]) + const handleSelectUrl = async (url: string, bookmark?: BookmarkReference) => { if (!relayPool) return @@ -182,7 +195,7 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { markdown={readerContent?.markdown} image={readerContent?.image} selectedUrl={selectedUrl} - highlights={highlights} + highlights={classifiedHighlights} showUnderlines={showUnderlines} highlightStyle={settings.highlightStyle || 'marker'} highlightColor={settings.highlightColor || '#ffff00'} diff --git a/src/index.css b/src/index.css index 77d744f6..33cf2201 100644 --- a/src/index.css +++ b/src/index.css @@ -477,7 +477,7 @@ body { .reader { background: #1a1a1a; border: 1px solid #333; - border-radius: 12px; + border-radius: 8px; padding: 1rem; text-align: left; overflow: hidden;