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
This commit is contained in:
Gigi
2025-10-05 20:26:03 +01:00
parent d4d54b1a7c
commit cc311c7dc4
2 changed files with 15 additions and 2 deletions

View File

@@ -128,6 +128,19 @@ const Bookmarks: React.FC<BookmarksProps> = ({ 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) => { const handleSelectUrl = async (url: string, bookmark?: BookmarkReference) => {
if (!relayPool) return if (!relayPool) return
@@ -182,7 +195,7 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
markdown={readerContent?.markdown} markdown={readerContent?.markdown}
image={readerContent?.image} image={readerContent?.image}
selectedUrl={selectedUrl} selectedUrl={selectedUrl}
highlights={highlights} highlights={classifiedHighlights}
showUnderlines={showUnderlines} showUnderlines={showUnderlines}
highlightStyle={settings.highlightStyle || 'marker'} highlightStyle={settings.highlightStyle || 'marker'}
highlightColor={settings.highlightColor || '#ffff00'} highlightColor={settings.highlightColor || '#ffff00'}

View File

@@ -477,7 +477,7 @@ body {
.reader { .reader {
background: #1a1a1a; background: #1a1a1a;
border: 1px solid #333; border: 1px solid #333;
border-radius: 12px; border-radius: 8px;
padding: 1rem; padding: 1rem;
text-align: left; text-align: left;
overflow: hidden; overflow: hidden;