diff options
author | polwex <polwex@sortug.com> | 2025-09-11 01:48:14 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-09-11 01:48:14 +0700 |
commit | b1d68ac307ed87d63e83820cbdf843fff0fd9f7f (patch) | |
tree | d6a684a70a80509e68ff667b842aa4e4c091906f /front/src/components/feed/NostrIcon.tsx |
init
Diffstat (limited to 'front/src/components/feed/NostrIcon.tsx')
-rw-r--r-- | front/src/components/feed/NostrIcon.tsx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/front/src/components/feed/NostrIcon.tsx b/front/src/components/feed/NostrIcon.tsx new file mode 100644 index 0000000..0c368fb --- /dev/null +++ b/front/src/components/feed/NostrIcon.tsx @@ -0,0 +1,22 @@ +import nostrIcon from "@/assets/icons/nostr.svg"; +import useLocalState from "@/state/state"; +import toast from "react-hot-toast"; +import type { Poast } from "@/types/trill"; +export default function ({ poast }: { poast: Poast }) { + const { relays, api, keys } = useLocalState(); + + async function sendToRelay(e: React.MouseEvent) { + e.stopPropagation(); + // + const urls = Object.keys(relays); + await api!.relayPost(poast.host, poast.id, urls); + toast.success("Post relayed"); + } + // TODO round up all helpers + + return ( + <div className="icon" role="link" onMouseUp={sendToRelay}> + <img role="link" src={nostrIcon} title="repost" /> + </div> + ); +} |