Zap split goals
This commit is contained in:
parent
dd4d73e81c
commit
0fa51dd7e5
@ -271,7 +271,6 @@ export default function NoteFooter(props: NoteFooterProps) {
|
||||
targets={getZapTarget()}
|
||||
onClose={() => setTip(false)}
|
||||
show={tip}
|
||||
author={author?.pubkey}
|
||||
note={ev.id}
|
||||
allocatePool={true}
|
||||
/>
|
||||
|
@ -36,7 +36,6 @@ export interface SendSatsProps {
|
||||
title?: ReactNode;
|
||||
notice?: string;
|
||||
note?: HexKey;
|
||||
author?: HexKey;
|
||||
allocatePool?: boolean;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import { useUserProfile } from "@snort/system-react";
|
||||
|
||||
import SendSats from "Element/SendSats";
|
||||
import Icon from "Icons/Icon";
|
||||
import { ZapTarget } from "Zapper";
|
||||
|
||||
const ZapButton = ({
|
||||
pubkey,
|
||||
@ -29,10 +30,9 @@ const ZapButton = ({
|
||||
{children}
|
||||
</div>
|
||||
<SendSats
|
||||
targets={[{ type: "lnurl", value: service, weight: 1, name: profile?.display_name || profile?.name }]}
|
||||
targets={[{ type: "lnurl", value: service, weight: 1, name: profile?.display_name || profile?.name, zap: { pubkey: pubkey } } as ZapTarget]}
|
||||
show={zap}
|
||||
onClose={() => setZap(false)}
|
||||
author={pubkey}
|
||||
note={event}
|
||||
/>
|
||||
</>
|
||||
|
@ -1,12 +1,15 @@
|
||||
import "./ZapGoal.css";
|
||||
import { CSSProperties, useState } from "react";
|
||||
import { NostrEvent, NostrPrefix, createNostrLink } from "@snort/system";
|
||||
import useZapsFeed from "Feed/ZapsFeed";
|
||||
import { formatShort } from "Number";
|
||||
import { findTag } from "SnortUtils";
|
||||
import { CSSProperties } from "react";
|
||||
import ZapButton from "./ZapButton";
|
||||
import Icon from "Icons/Icon";
|
||||
import SendSats from "./SendSats";
|
||||
import { Zapper } from "Zapper";
|
||||
|
||||
export function ZapGoal({ ev }: { ev: NostrEvent }) {
|
||||
const [zap, setZap] = useState(false);
|
||||
const zaps = useZapsFeed(createNostrLink(NostrPrefix.Note, ev.id));
|
||||
const target = Number(findTag(ev, "amount"));
|
||||
const amount = zaps.reduce((acc, v) => (acc += v.amount * 1000), 0);
|
||||
@ -16,7 +19,14 @@ export function ZapGoal({ ev }: { ev: NostrEvent }) {
|
||||
<div className="zap-goal card">
|
||||
<div className="flex f-space">
|
||||
<h2>{ev.content}</h2>
|
||||
<ZapButton pubkey={ev.pubkey} event={ev.id} />
|
||||
<div className="zap-button flex" onClick={() => setZap(true)}>
|
||||
<Icon name="zap" size={15} />
|
||||
</div>
|
||||
<SendSats
|
||||
targets={Zapper.fromEvent(ev)}
|
||||
show={zap}
|
||||
onClose={() => setZap(false)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex f-space">
|
||||
|
@ -54,6 +54,7 @@ import useHorizontalScroll from "Hooks/useHorizontalScroll";
|
||||
import { EmailRegex } from "Const";
|
||||
import { getNip05PubKey } from "Pages/LoginPage";
|
||||
import useLogin from "Hooks/useLogin";
|
||||
import { ZapTarget } from "Zapper";
|
||||
|
||||
import messages from "./messages";
|
||||
|
||||
@ -292,13 +293,12 @@ export default function ProfilePage() {
|
||||
|
||||
<SendSats
|
||||
targets={
|
||||
lnurl?.lnurl
|
||||
? [{ type: "lnurl", value: lnurl?.lnurl, weight: 1, name: user?.display_name || user?.name }]
|
||||
lnurl?.lnurl && id
|
||||
? [{ type: "lnurl", value: lnurl?.lnurl, weight: 1, name: user?.display_name || user?.name, zap: { pubkey: id } } as ZapTarget]
|
||||
: undefined
|
||||
}
|
||||
show={showLnQr}
|
||||
onClose={() => setShowLnQr(false)}
|
||||
author={id}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user