import { AccountContext } from '@components/accountProvider'; import { RelayContext } from '@components/relaysProvider'; import { MESSAGE_RELAYS } from '@stores/constants'; import { dateToUnix } from '@utils/getDate'; import * as AlertDialog from '@radix-ui/react-alert-dialog'; import * as Tooltip from '@radix-ui/react-tooltip'; import { EyeClose } from 'iconoir-react'; import { getEventHash, signEvent } from 'nostr-tools'; import { useCallback, useContext } from 'react'; export const HideMessageButton = ({ id }: { id: string }) => { const pool: any = useContext(RelayContext); const activeAccount: any = useContext(AccountContext); const hideMessage = useCallback(() => { const event: any = { content: '', created_at: dateToUnix(), kind: 43, pubkey: activeAccount.pubkey, tags: [['e', id]], }; event.id = getEventHash(event); event.sig = signEvent(event, activeAccount.privkey); // publish note pool.publish(event, MESSAGE_RELAYS); }, [activeAccount.pubkey, activeAccount.privkey, id, pool]); return ( Hide this message Are you absolutely sure? This action cannot be undone. This will permanently hide this message and you will never see this again
); };