feat: optimize the display effect of other kinds of events

This commit is contained in:
codytseng
2025-02-13 22:56:09 +08:00
parent 5e3fd93a23
commit 73b38d37e7
17 changed files with 719 additions and 66 deletions

View File

@@ -45,6 +45,10 @@ export function isProtectedEvent(event: Event) {
return event.tags.some(([tagName]) => tagName === '-')
}
export function isSupportedKind(kind: number) {
return [kinds.ShortTextNote, PICTURE_EVENT_KIND].includes(kind)
}
export function getParentEventId(event?: Event) {
if (!event || !isReplyNoteEvent(event)) return undefined
const tag = event.tags.find(isReplyETag) ?? event.tags.find(tagNameEquals('e'))
@@ -81,7 +85,7 @@ export function getEventCoordinate(event: Event) {
}
export function getSharableEventId(event: Event) {
const hints = client.getEventHints(event.id).slice(0, 3)
const hints = client.getEventHints(event.id).slice(0, 2)
if (isReplaceable(event.kind)) {
const identifier = event.tags.find(tagNameEquals('d'))?.[1] ?? ''
return nip19.naddrEncode({ pubkey: event.pubkey, kind: event.kind, identifier, relays: hints })