import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { useState } from 'react'; import { toast } from 'sonner'; import { useNDK } from '@libs/ndk/provider'; import { useStorage } from '@libs/storage/provider'; import { ReplyMediaUploader } from '@shared/notes'; import { User } from '@shared/user'; export function NoteReplyForm({ id }: { id: string }) { const { db } = useStorage(); const { ndk, relayUrls } = useNDK(); const [value, setValue] = useState(''); const submit = async () => { const tags = [['e', id, relayUrls[0], 'root']]; // publish event const event = new NDKEvent(ndk); event.content = value; event.kind = NDKKind.Text; event.tags = tags; const publishedRelays = await event.publish(); if (publishedRelays) { toast.success(`Broadcasted to ${publishedRelays.size} relays successfully.`); setValue(''); } }; return (