snort/src/element/ZapButton.tsx

25 lines
788 B
TypeScript
Raw Normal View History

2023-01-19 00:03:24 +00:00
import { faBolt } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useState } from "react";
import useProfile from "../feed/ProfileFeed";
import { HexKey } from "../nostr";
import LNURLTip from "./LNURLTip";
const ZapButton = ({ pubkey }: { pubkey: HexKey }) => {
const profile = useProfile(pubkey)?.get(pubkey);
const [zap, setZap] = useState(false);
const svc = profile?.lud16 || profile?.lud06;
if (!svc) return null;
return (
<>
2023-01-18 23:31:34 +00:00
<div className="pill" onClick={(e) => setZap(true)}>
2023-01-19 00:03:24 +00:00
<FontAwesomeIcon icon={faBolt} />
2023-01-18 23:31:34 +00:00
</div>
2023-01-19 00:03:24 +00:00
<LNURLTip svc={svc} show={zap} onClose={() => setZap(false)} />
</>
)
}
export default ZapButton;