EmojiPackPreview.tsx raw
1 import { getEmojiPackInfoFromEvent } from '@/lib/event-metadata'
2 import { cn } from '@/lib/utils'
3 import { Event } from 'nostr-tools'
4 import { useMemo } from 'react'
5 import { useTranslation } from 'react-i18next'
6
7 export default function EmojiPackPreview({
8 event,
9 className
10 }: {
11 event: Event
12 className?: string
13 }) {
14 const { t } = useTranslation()
15 const { title, emojis } = useMemo(() => getEmojiPackInfoFromEvent(event), [event])
16
17 return (
18 <div className={cn('pointer-events-none', className)}>
19 [{t('Emoji Pack')}] <span className="italic pr-0.5">{title}</span>
20 {emojis.length > 0 && <span>({emojis.length})</span>}
21 </div>
22 )
23 }
24