summaryrefslogtreecommitdiff
path: root/gui/src/components/post/wrappers/NostrIcon.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src/components/post/wrappers/NostrIcon.tsx')
-rw-r--r--gui/src/components/post/wrappers/NostrIcon.tsx25
1 files changed, 25 insertions, 0 deletions
diff --git a/gui/src/components/post/wrappers/NostrIcon.tsx b/gui/src/components/post/wrappers/NostrIcon.tsx
new file mode 100644
index 0000000..30fbfe9
--- /dev/null
+++ b/gui/src/components/post/wrappers/NostrIcon.tsx
@@ -0,0 +1,25 @@
+import Icon from "@/components/Icon";
+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 } = useLocalState((s) => ({
+ relays: s.relays,
+ api: s.api,
+ }));
+
+ 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}>
+ <Icon name="nostr" size={20} title="relay to nostr" />
+ </div>
+ );
+}