multiple zapping issues resolved for confirming and showing active states of zaps #36

Merged
freakoverse merged 6 commits from staging into master 2024-09-11 18:02:41 +00:00
3 changed files with 14 additions and 2 deletions
Showing only changes of commit 7a1d0bbfb0 - Show all commits

View File

@ -120,6 +120,7 @@ type ZapQRProps = {
handleClose: () => void
handleQRExpiry: () => void
setTotalZapAmount?: Dispatch<SetStateAction<number>>
setHasZapped?: Dispatch<SetStateAction<boolean>>
}
export const ZapQR = React.memo(
@ -127,7 +128,8 @@ export const ZapQR = React.memo(
paymentRequest,
handleClose,
handleQRExpiry,
setTotalZapAmount
setTotalZapAmount,
setHasZapped
}: ZapQRProps) => {
useDidMount(() => {
ZapController.getInstance()
@ -137,6 +139,7 @@ export const ZapQR = React.memo(
if (setTotalZapAmount) {
const amount = getZapAmount(zapReceipt)
setTotalZapAmount((prev) => prev + amount)
if (setHasZapped) setHasZapped(true)
}
})
.catch((err) => {
@ -227,6 +230,8 @@ type ZapPopUpProps = {
notCloseAfterZap?: boolean
lastNode?: ReactNode
setTotalZapAmount?: Dispatch<SetStateAction<number>>
setHasZapped?: Dispatch<SetStateAction<boolean>>
handleClose: () => void
}
@ -239,6 +244,7 @@ export const ZapPopUp = ({
lastNode,
notCloseAfterZap,
setTotalZapAmount,
setHasZapped,
handleClose
}: ZapPopUpProps) => {
const [isLoading, setIsLoading] = useState(false)
@ -337,6 +343,8 @@ export const ZapPopUp = ({
toast.success(`Successfully sent ${amount} sats!`)
if (setTotalZapAmount) {
setTotalZapAmount((prev) => prev + amount)
if (setHasZapped) setHasZapped(true)
}
if (!notCloseAfterZap) {
@ -357,7 +365,8 @@ export const ZapPopUp = ({
notCloseAfterZap,
handleClose,
generatePaymentRequest,
setTotalZapAmount
setTotalZapAmount,
setHasZapped
])
const handleQRExpiry = useCallback(() => {
@ -438,6 +447,7 @@ export const ZapPopUp = ({
handleClose={handleQRClose}
handleQRExpiry={handleQRExpiry}
setTotalZapAmount={setTotalZapAmount}
setHasZapped={setHasZapped}
/>
)}
{lastNode}

View File

@ -590,6 +590,7 @@ const Zap = (props: Event) => {
eventId={props.id}
handleClose={() => setIsOpen(false)}
setTotalZapAmount={setTotalZappedAmount}
setHasZapped={setHasZapped}
/>
)}
</>

View File

@ -74,6 +74,7 @@ export const Zap = ({ modDetails }: ZapProps) => {
lastNode={<ZapSite />}
notCloseAfterZap
setTotalZapAmount={setTotalZappedAmount}
setHasZapped={setHasZapped}
/>
)}
</>