diff --git a/public/icons.svg b/public/icons.svg index f683e4f..1571504 100644 --- a/public/icons.svg +++ b/public/icons.svg @@ -49,6 +49,10 @@ - + + + + + diff --git a/src/element/send-zap.tsx b/src/element/send-zap.tsx index c56eb8e..d8f0ce6 100644 --- a/src/element/send-zap.tsx +++ b/src/element/send-zap.tsx @@ -215,7 +215,7 @@ export function SendZapsDialog(props: Omit) { ) : ( )} diff --git a/src/element/share-menu.tsx b/src/element/share-menu.tsx new file mode 100644 index 0000000..f04aa4a --- /dev/null +++ b/src/element/share-menu.tsx @@ -0,0 +1,89 @@ +import { Menu, MenuItem } from "@szhsin/react-menu"; +import * as Dialog from "@radix-ui/react-dialog"; +import { Icon } from "./icon"; +import { useState } from "react"; +import { Textarea } from "./textarea"; +import { NostrEvent, NostrPrefix, encodeTLV } from "@snort/system"; +import { findTag } from "utils"; +import AsyncButton from "./async-button"; +import { useLogin } from "hooks/login"; +import { System } from "index"; + +type ShareOn = "nostr" | "twitter"; + +export function ShareMenu({ ev }: { ev: NostrEvent }) { + const [share, setShare] = useState(); + const [message, setMessage] = useState(""); + const login = useLogin(); + + const naddr = encodeTLV( + NostrPrefix.Address, + findTag(ev, "d")!, + undefined, + ev.kind, + ev.pubkey + ); + const link = `https://zap.stream/${naddr}`; + + async function sendMessage() { + const pub = login?.publisher(); + if (pub) { + const ev = await pub.note(message); + console.debug(ev); + System.BroadcastEvent(ev); + setShare(undefined); + } + } + + return ( + <> + + Share + + } + > + { + setMessage( + `Come check out my stream on zap.stream!\n\n${link}\n\nnostr:${naddr}` + ); + setShare("nostr"); + }} + > + + Broadcast on Nostr + + + setShare(undefined)} + > + + + +

Share

+
+