feat: show article titles for kind:30023 bookmarks

- Update hydrateItems to detect long-form articles (kind:30023)
- Extract and display article title using getArticleTitle helper
- Article titles now appear as bookmark content in lists
- Provides better context for bookmarked articles
This commit is contained in:
Gigi
2025-10-05 08:17:34 +01:00
parent edd4e20e22
commit d5e847e515
2 changed files with 14 additions and 3 deletions

2
dist/index.html vendored
View File

@@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Boris - Nostr Bookmarks</title>
<script type="module" crossorigin src="/assets/index-Cu-7RlRs.js"></script>
<script type="module" crossorigin src="/assets/index-BldIeAhn.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-ChEoItgK.css">
</head>
<body>

View File

@@ -1,4 +1,5 @@
import { getParsedContent } from 'applesauce-content/text'
import { getArticleTitle } from 'applesauce-core/helpers'
import { ActiveAccount, IndividualBookmark, ParsedContent } from '../types/bookmarks'
import type { NostrEvent } from './bookmarkEvents'
@@ -94,14 +95,24 @@ export function hydrateItems(
return items.map(item => {
const ev = idToEvent.get(item.id)
if (!ev) return item
// For long-form articles (kind:30023), use the article title as content
let content = ev.content || item.content || ''
if (ev.kind === 30023) {
const articleTitle = getArticleTitle(ev)
if (articleTitle) {
content = articleTitle
}
}
return {
...item,
pubkey: ev.pubkey || item.pubkey,
content: ev.content || item.content || '',
content,
created_at: ev.created_at || item.created_at,
kind: ev.kind || item.kind,
tags: ev.tags || item.tags,
parsedContent: ev.content ? (getParsedContent(ev.content) as ParsedContent) : item.parsedContent
parsedContent: ev.content ? (getParsedContent(content) as ParsedContent) : item.parsedContent
}
})
}