import { contentParser } from '@lume/app/newsfeed/components/contentParser'; import { NoteDefaultUser } from '@lume/app/newsfeed/components/user/default'; import { READONLY_RELAYS } from '@lume/stores/constants'; import { RelayPool } from 'nostr-relaypool'; import { memo } from 'react'; import useSWRSubscription from 'swr/subscription'; export const NoteParent = memo(function NoteParent({ id }: { id: string }) { const { data, error } = useSWRSubscription( id ? [ { ids: [id], kinds: [1], }, ] : null, (key, { next }) => { const pool = new RelayPool(READONLY_RELAYS); const unsubscribe = pool.subscribe( key, READONLY_RELAYS, (event: any) => { next(null, event); }, undefined, undefined, { unsubscribeOnEose: true, } ); return () => { unsubscribe(); }; } ); return (
{error &&
failed to load
} {!data ? (
ยท
) : ( <>
{contentParser(data.content, data.tags)}
e.stopPropagation()} className="mt-5 pl-[52px]">
)}
); });