import { RelayContext } from '@components/relaysProvider'; import { dateToUnix } from '@utils/getDate'; import HideIcon from '@assets/icons/hide'; import * as AlertDialog from '@radix-ui/react-alert-dialog'; import * as Tooltip from '@radix-ui/react-tooltip'; import useLocalStorage from '@rehooks/local-storage'; import { getEventHash, signEvent } from 'nostr-tools'; import { useCallback, useContext } from 'react'; export const HideMessageButton = ({ id }: { id: string }) => { const [pool, relays]: any = useContext(RelayContext); const [activeAccount]: any = useLocalStorage('activeAccount', {}); 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, relays); }, [id, activeAccount.privkey, activeAccount.pubkey, pool, relays]); 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
); };