import { ImageWithFallback } from '@components/imageWithFallback'; import { RelayContext } from '@components/relaysProvider'; import { dateToUnix } from '@utils/getDate'; import useLocalStorage from '@rehooks/local-storage'; import { getEventHash, signEvent } from 'nostr-tools'; import { useContext, useState } from 'react'; export default function FormComment({ eventID }: { eventID: any }) { const [pool, relays]: any = useContext(RelayContext); const [activeAccount]: any = useLocalStorage('account', {}); const [value, setValue] = useState(''); const profile = JSON.parse(activeAccount.metadata); const submitEvent = () => { const event: any = { content: value, created_at: dateToUnix(), kind: 1, pubkey: activeAccount.pubkey, tags: [['e', eventID]], }; event.id = getEventHash(event); event.sig = signEvent(event, activeAccount.privkey); // publish note pool.publish(event, relays); // send notification // sendNotification('Comment has been published successfully'); }; return (