import EmojiPicker from '@components/form/emojiPicker'; import ImagePicker from '@components/form/imagePicker'; import { RelayContext } from '@components/relaysProvider'; import { noteContentAtom } from '@stores/note'; import { dateToUnix } from '@utils/getDate'; import useLocalStorage from '@rehooks/local-storage'; import { useAtom } from 'jotai'; import { useResetAtom } from 'jotai/utils'; import { getEventHash, signEvent } from 'nostr-tools'; import { useContext } from 'react'; export default function FormBase() { const [pool, relays]: any = useContext(RelayContext); const [value, setValue] = useAtom(noteContentAtom); const resetValue = useResetAtom(noteContentAtom); const [activeAccount]: any = useLocalStorage('activeAccount'); const submitEvent = () => { const event: any = { content: value, created_at: dateToUnix(), kind: 1, pubkey: activeAccount.pubkey, tags: [], }; event.id = getEventHash(event); event.sig = signEvent(event, activeAccount.privkey); // publish note pool.publish(event, relays); // reset form resetValue(); // send notification // sendNotification('Note has been published successfully'); }; return (