import EmojiPicker from '@components/form/emojiPicker'; import { RelayContext } from '@components/relaysProvider'; import { activeAccountAtom } from '@stores/account'; import { noteContentAtom } from '@stores/note'; import { relaysAtom } from '@stores/relays'; import { dateToUnix } from '@utils/getDate'; import { ImageIcon, ResetIcon } from '@radix-ui/react-icons'; import { useAtom, useAtomValue } from 'jotai'; import { useResetAtom } from 'jotai/utils'; import { getEventHash, signEvent } from 'nostr-tools'; import { useContext } from 'react'; export default function FormBase() { const pool: any = useContext(RelayContext); const relays = useAtomValue(relaysAtom); const [activeAccount] = useAtom(activeAccountAtom); const [value, setValue] = useAtom(noteContentAtom); const resetValue = useResetAtom(noteContentAtom); const pubkey = activeAccount.id; const privkey = activeAccount.privkey; const submitEvent = () => { const event: any = { content: value, created_at: dateToUnix(), kind: 1, pubkey: pubkey, tags: [], }; event.id = getEventHash(event); event.sig = signEvent(event, privkey); pool.publish(event, relays); resetValue; }; return (