import { NDKEvent, NDKPrivateKeySigner } from "@nostr-dev-kit/ndk"; import { Image } from "@shared/image"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { DEFAULT_AVATAR } from "@stores/constants"; import { dateToUnix } from "@utils/date"; import { useProfile } from "@utils/hooks/useProfile"; import { useContext, useState } from "react"; export function NoteReplyForm({ id }: { id: string }) { const ndk = useContext(RelayContext); const account = useActiveAccount((state: any) => state.account); const { user } = useProfile(account.npub); const [value, setValue] = useState(""); const submitEvent = () => { const signer = new NDKPrivateKeySigner(account.privkey); ndk.signer = signer; const event = new NDKEvent(ndk); // build event event.content = value; event.kind = 1; event.created_at = dateToUnix(); event.pubkey = account.pubkey; event.tags = [["e", id]]; // publish event event.publish(); // reset form setValue(""); }; return (