Files
snort/src/element/ZapButton.tsx
2023-01-19 12:14:41 +01:00

27 lines
821 B
TypeScript

import "./ZapButton.css";
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 (
<>
<div className="zap-button" onClick={(e) => setZap(true)}>
<FontAwesomeIcon icon={faBolt} />
</div>
<LNURLTip svc={svc} show={zap} onClose={() => setZap(false)} />
</>
)
}
export default ZapButton;