import { ExtendedKind } from '@/constants' import { tagNameEquals } from '@/lib/tag' import { cn } from '@/lib/utils' import { Event } from 'nostr-tools' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' export default function IValue({ event, className }: { event: Event; className?: string }) { const { t } = useTranslation() const iValue = useMemo(() => { if (event.kind !== ExtendedKind.COMMENT) return undefined const iTag = event.tags.find(tagNameEquals('i')) return iTag ? iTag[1] : undefined }, [event]) if (!iValue) return null return (
{t('Comment on') + ' '} {iValue.startsWith('http') ? ( e.stopPropagation()} > {iValue} ) : ( {iValue} )}
) }