fix: show images in embedded kind:20 notes
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
import { useSecondaryPage } from '@/PageManager'
|
import { useSecondaryPage } from '@/PageManager'
|
||||||
|
import { ExtendedKind } from '@/constants'
|
||||||
import { useFetchEvent } from '@/hooks'
|
import { useFetchEvent } from '@/hooks'
|
||||||
import { getParentEventId, getUsingClient } from '@/lib/event'
|
import { extractImageInfosFromEventTags, getParentEventId, getUsingClient } from '@/lib/event'
|
||||||
import { toNote } from '@/lib/link'
|
import { toNote } from '@/lib/link'
|
||||||
import { Event } from 'nostr-tools'
|
import { Event } from 'nostr-tools'
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
import Content from '../Content'
|
import Content from '../Content'
|
||||||
import { FormattedTimestamp } from '../FormattedTimestamp'
|
import { FormattedTimestamp } from '../FormattedTimestamp'
|
||||||
|
import ImageGallery from '../ImageGallery'
|
||||||
import NoteOptions from '../NoteOptions'
|
import NoteOptions from '../NoteOptions'
|
||||||
import NoteStats from '../NoteStats'
|
import NoteStats from '../NoteStats'
|
||||||
import ParentNotePreview from '../ParentNotePreview'
|
import ParentNotePreview from '../ParentNotePreview'
|
||||||
@@ -32,6 +34,7 @@ export default function Note({
|
|||||||
() => (hideParentNotePreview ? undefined : getParentEventId(event)),
|
() => (hideParentNotePreview ? undefined : getParentEventId(event)),
|
||||||
[event, hideParentNotePreview]
|
[event, hideParentNotePreview]
|
||||||
)
|
)
|
||||||
|
const imageInfos = useMemo(() => extractImageInfosFromEventTags(event), [event])
|
||||||
const { event: parentEvent, isFetching } = useFetchEvent(parentEventId)
|
const { event: parentEvent, isFetching } = useFetchEvent(parentEventId)
|
||||||
const usingClient = useMemo(() => getUsingClient(event), [event])
|
const usingClient = useMemo(() => getUsingClient(event), [event])
|
||||||
|
|
||||||
@@ -72,6 +75,9 @@ export default function Note({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Content className="mt-2" event={event} />
|
<Content className="mt-2" event={event} />
|
||||||
|
{event.kind === ExtendedKind.PICTURE && imageInfos.length > 0 && (
|
||||||
|
<ImageGallery images={imageInfos} />
|
||||||
|
)}
|
||||||
{!hideStats && (
|
{!hideStats && (
|
||||||
<NoteStats className="mt-3" event={event} fetchIfNotExisting={fetchNoteStats} />
|
<NoteStats className="mt-3" event={event} fetchIfNotExisting={fetchNoteStats} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user