feat: highlight reactions notifications
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
|||||||
} from '@/lib/content-parser'
|
} from '@/lib/content-parser'
|
||||||
import { extractEmojiInfosFromTags } from '@/lib/event'
|
import { extractEmojiInfosFromTags } from '@/lib/event'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { Event } from 'nostr-tools'
|
import { Event, kinds } from 'nostr-tools'
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { EmbeddedMentionText } from '../Embedded'
|
import { EmbeddedMentionText } from '../Embedded'
|
||||||
@@ -27,6 +27,8 @@ export default function ContentPreview({
|
|||||||
const nodes = useMemo(() => {
|
const nodes = useMemo(() => {
|
||||||
if (!event) return [{ type: 'text', data: `[${t('Not found the note')}]` }]
|
if (!event) return [{ type: 'text', data: `[${t('Not found the note')}]` }]
|
||||||
|
|
||||||
|
if (event.kind === kinds.Highlights) return []
|
||||||
|
|
||||||
return parseContent(event.content, [
|
return parseContent(event.content, [
|
||||||
EmbeddedImageParser,
|
EmbeddedImageParser,
|
||||||
EmbeddedVideoParser,
|
EmbeddedVideoParser,
|
||||||
@@ -36,6 +38,14 @@ export default function ContentPreview({
|
|||||||
])
|
])
|
||||||
}, [event])
|
}, [event])
|
||||||
|
|
||||||
|
if (event?.kind === kinds.Highlights) {
|
||||||
|
return (
|
||||||
|
<div className={cn('pointer-events-none italic', className)} onClick={onClick}>
|
||||||
|
{event.content}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const emojiInfos = extractEmojiInfosFromTags(event?.tags)
|
const emojiInfos = extractEmojiInfosFromTags(event?.tags)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import Image from '@/components/Image'
|
import Image from '@/components/Image'
|
||||||
import { ExtendedKind } from '@/constants'
|
|
||||||
import { useFetchEvent } from '@/hooks'
|
import { useFetchEvent } from '@/hooks'
|
||||||
|
import { isSupportedKind } from '@/lib/event'
|
||||||
import { toNote } from '@/lib/link'
|
import { toNote } from '@/lib/link'
|
||||||
import { tagNameEquals } from '@/lib/tag'
|
import { tagNameEquals } from '@/lib/tag'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { useSecondaryPage } from '@/PageManager'
|
import { useSecondaryPage } from '@/PageManager'
|
||||||
import { useNostr } from '@/providers/NostrProvider'
|
import { useNostr } from '@/providers/NostrProvider'
|
||||||
import { Heart } from 'lucide-react'
|
import { Heart } from 'lucide-react'
|
||||||
import { Event, kinds } from 'nostr-tools'
|
import { Event } from 'nostr-tools'
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
import ContentPreview from '../../ContentPreview'
|
import ContentPreview from '../../ContentPreview'
|
||||||
import { FormattedTimestamp } from '../../FormattedTimestamp'
|
import { FormattedTimestamp } from '../../FormattedTimestamp'
|
||||||
@@ -54,7 +54,7 @@ export function ReactionNotification({
|
|||||||
return notification.content
|
return notification.content
|
||||||
}, [notification])
|
}, [notification])
|
||||||
|
|
||||||
if (!event || !eventId || ![kinds.ShortTextNote, ExtendedKind.PICTURE].includes(event.kind)) {
|
if (!event || !eventId || !isSupportedKind(event.kind)) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user