Setup lang
This commit is contained in:
@ -10,6 +10,7 @@ import { findTag } from "utils";
|
||||
import AsyncButton from "./async-button";
|
||||
import { useLogin } from "hooks/login";
|
||||
import { System } from "index";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
type ShareOn = "nostr" | "twitter";
|
||||
|
||||
@ -18,13 +19,7 @@ export function ShareMenu({ ev }: { ev: NostrEvent }) {
|
||||
const [message, setMessage] = useState("");
|
||||
const login = useLogin();
|
||||
|
||||
const naddr = encodeTLV(
|
||||
NostrPrefix.Address,
|
||||
unwrap(findTag(ev, "d")),
|
||||
undefined,
|
||||
ev.kind,
|
||||
ev.pubkey
|
||||
);
|
||||
const naddr = encodeTLV(NostrPrefix.Address, unwrap(findTag(ev, "d")), undefined, ev.kind, ev.pubkey);
|
||||
const link = `https://zap.stream/${naddr}`;
|
||||
|
||||
async function sendMessage() {
|
||||
@ -45,35 +40,30 @@ export function ShareMenu({ ev }: { ev: NostrEvent }) {
|
||||
menuClassName="ctx-menu"
|
||||
menuButton={
|
||||
<button type="button" className="btn btn-secondary">
|
||||
Share
|
||||
<FormattedMessage defaultMessage="Share" />
|
||||
</button>
|
||||
}
|
||||
>
|
||||
}>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setMessage(
|
||||
`Come check out my stream on zap.stream!\n\n${link}\n\nnostr:${naddr}`
|
||||
);
|
||||
setMessage(`Come check out my stream on zap.stream!\n\n${link}\n\nnostr:${naddr}`);
|
||||
setShare("nostr");
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<Icon name="nostrich" size={24} />
|
||||
Broadcast on Nostr
|
||||
<FormattedMessage defaultMessage="Broadcast on Nostr" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Dialog.Root
|
||||
open={Boolean(share)}
|
||||
onOpenChange={() => setShare(undefined)}
|
||||
>
|
||||
<Dialog.Root open={Boolean(share)} onOpenChange={() => setShare(undefined)}>
|
||||
<Dialog.Portal>
|
||||
<Dialog.Overlay className="dialog-overlay" />
|
||||
<Dialog.Content className="dialog-content">
|
||||
<h2>Share</h2>
|
||||
<h2>
|
||||
<FormattedMessage defaultMessage="Share" />
|
||||
</h2>
|
||||
<div className="paper">
|
||||
<Textarea
|
||||
emojis={[]}
|
||||
value={message}
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
onChange={e => setMessage(e.target.value)}
|
||||
onKeyDown={() => {
|
||||
//noop
|
||||
}}
|
||||
@ -81,7 +71,7 @@ export function ShareMenu({ ev }: { ev: NostrEvent }) {
|
||||
/>
|
||||
</div>
|
||||
<AsyncButton className="btn btn-primary" onClick={sendMessage}>
|
||||
Send
|
||||
<FormattedMessage defaultMessage="Send" />
|
||||
</AsyncButton>
|
||||
</Dialog.Content>
|
||||
</Dialog.Portal>
|
||||
|
Reference in New Issue
Block a user