2023-01-19 11:14:41 +00:00
|
|
|
import "./ZapButton.css";
|
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";
|
2023-01-27 21:38:41 +00:00
|
|
|
import { useUserProfile } from "Feed/ProfileFeed";
|
2023-02-11 20:05:46 +00:00
|
|
|
import { HexKey } from "@snort/nostr";
|
2023-02-07 13:32:32 +00:00
|
|
|
import SendSats from "Element/SendSats";
|
2023-01-19 00:03:24 +00:00
|
|
|
|
2023-02-07 19:47:57 +00:00
|
|
|
const ZapButton = ({ pubkey, svc }: { pubkey: HexKey; svc?: string }) => {
|
|
|
|
const profile = useUserProfile(pubkey);
|
2023-02-07 20:04:50 +00:00
|
|
|
const [zap, setZap] = useState(false);
|
|
|
|
const service = svc ?? (profile?.lud16 || profile?.lud06);
|
2023-01-27 21:38:41 +00:00
|
|
|
|
2023-02-07 20:04:50 +00:00
|
|
|
if (!service) return null;
|
2023-01-19 00:03:24 +00:00
|
|
|
|
2023-02-07 20:04:50 +00:00
|
|
|
return (
|
|
|
|
<>
|
2023-02-07 19:47:57 +00:00
|
|
|
<div className="zap-button" onClick={() => setZap(true)}>
|
2023-02-07 20:04:50 +00:00
|
|
|
<FontAwesomeIcon icon={faBolt} />
|
|
|
|
</div>
|
|
|
|
<SendSats
|
|
|
|
target={profile?.display_name || profile?.name}
|
|
|
|
svc={service}
|
|
|
|
show={zap}
|
|
|
|
onClose={() => setZap(false)}
|
|
|
|
author={pubkey}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
2023-01-19 00:03:24 +00:00
|
|
|
|
2023-01-19 11:14:41 +00:00
|
|
|
export default ZapButton;
|