import { useFetchEvent } from '@/hooks' import { getZapInfoFromEvent } from '@/lib/event-metadata' import { formatAmount } from '@/lib/lightning' import { cn } from '@/lib/utils' import { Zap } from 'lucide-react' import { Event } from 'nostr-tools' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import Username from '../Username' export default function ZapPreview({ event, className }: { event: Event; className?: string }) { const { t } = useTranslation() const zapInfo = useMemo(() => getZapInfoFromEvent(event), [event]) const { event: targetEvent } = useFetchEvent(zapInfo?.eventId) if (!zapInfo || !zapInfo.senderPubkey || !zapInfo.amount) { return (
{comment}
) : null}