multiple zapping issues resolved for confirming and showing active states of zaps #36
@ -120,6 +120,7 @@ type ZapQRProps = {
|
|||||||
handleClose: () => void
|
handleClose: () => void
|
||||||
handleQRExpiry: () => void
|
handleQRExpiry: () => void
|
||||||
setTotalZapAmount?: Dispatch<SetStateAction<number>>
|
setTotalZapAmount?: Dispatch<SetStateAction<number>>
|
||||||
|
setHasZapped?: Dispatch<SetStateAction<boolean>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ZapQR = React.memo(
|
export const ZapQR = React.memo(
|
||||||
@ -127,7 +128,8 @@ export const ZapQR = React.memo(
|
|||||||
paymentRequest,
|
paymentRequest,
|
||||||
handleClose,
|
handleClose,
|
||||||
handleQRExpiry,
|
handleQRExpiry,
|
||||||
setTotalZapAmount
|
setTotalZapAmount,
|
||||||
|
setHasZapped
|
||||||
}: ZapQRProps) => {
|
}: ZapQRProps) => {
|
||||||
useDidMount(() => {
|
useDidMount(() => {
|
||||||
ZapController.getInstance()
|
ZapController.getInstance()
|
||||||
@ -137,6 +139,7 @@ export const ZapQR = React.memo(
|
|||||||
if (setTotalZapAmount) {
|
if (setTotalZapAmount) {
|
||||||
const amount = getZapAmount(zapReceipt)
|
const amount = getZapAmount(zapReceipt)
|
||||||
setTotalZapAmount((prev) => prev + amount)
|
setTotalZapAmount((prev) => prev + amount)
|
||||||
|
if (setHasZapped) setHasZapped(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@ -227,6 +230,8 @@ type ZapPopUpProps = {
|
|||||||
notCloseAfterZap?: boolean
|
notCloseAfterZap?: boolean
|
||||||
lastNode?: ReactNode
|
lastNode?: ReactNode
|
||||||
setTotalZapAmount?: Dispatch<SetStateAction<number>>
|
setTotalZapAmount?: Dispatch<SetStateAction<number>>
|
||||||
|
setHasZapped?: Dispatch<SetStateAction<boolean>>
|
||||||
|
|
||||||
handleClose: () => void
|
handleClose: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,6 +244,7 @@ export const ZapPopUp = ({
|
|||||||
lastNode,
|
lastNode,
|
||||||
notCloseAfterZap,
|
notCloseAfterZap,
|
||||||
setTotalZapAmount,
|
setTotalZapAmount,
|
||||||
|
setHasZapped,
|
||||||
handleClose
|
handleClose
|
||||||
}: ZapPopUpProps) => {
|
}: ZapPopUpProps) => {
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
@ -337,6 +343,8 @@ export const ZapPopUp = ({
|
|||||||
toast.success(`Successfully sent ${amount} sats!`)
|
toast.success(`Successfully sent ${amount} sats!`)
|
||||||
if (setTotalZapAmount) {
|
if (setTotalZapAmount) {
|
||||||
setTotalZapAmount((prev) => prev + amount)
|
setTotalZapAmount((prev) => prev + amount)
|
||||||
|
|
||||||
|
if (setHasZapped) setHasZapped(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!notCloseAfterZap) {
|
if (!notCloseAfterZap) {
|
||||||
@ -357,7 +365,8 @@ export const ZapPopUp = ({
|
|||||||
notCloseAfterZap,
|
notCloseAfterZap,
|
||||||
handleClose,
|
handleClose,
|
||||||
generatePaymentRequest,
|
generatePaymentRequest,
|
||||||
setTotalZapAmount
|
setTotalZapAmount,
|
||||||
|
setHasZapped
|
||||||
])
|
])
|
||||||
|
|
||||||
const handleQRExpiry = useCallback(() => {
|
const handleQRExpiry = useCallback(() => {
|
||||||
@ -438,6 +447,7 @@ export const ZapPopUp = ({
|
|||||||
handleClose={handleQRClose}
|
handleClose={handleQRClose}
|
||||||
handleQRExpiry={handleQRExpiry}
|
handleQRExpiry={handleQRExpiry}
|
||||||
setTotalZapAmount={setTotalZapAmount}
|
setTotalZapAmount={setTotalZapAmount}
|
||||||
|
setHasZapped={setHasZapped}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{lastNode}
|
{lastNode}
|
||||||
|
@ -590,6 +590,7 @@ const Zap = (props: Event) => {
|
|||||||
eventId={props.id}
|
eventId={props.id}
|
||||||
handleClose={() => setIsOpen(false)}
|
handleClose={() => setIsOpen(false)}
|
||||||
setTotalZapAmount={setTotalZappedAmount}
|
setTotalZapAmount={setTotalZappedAmount}
|
||||||
|
setHasZapped={setHasZapped}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
@ -74,6 +74,7 @@ export const Zap = ({ modDetails }: ZapProps) => {
|
|||||||
lastNode={<ZapSite />}
|
lastNode={<ZapSite />}
|
||||||
notCloseAfterZap
|
notCloseAfterZap
|
||||||
setTotalZapAmount={setTotalZappedAmount}
|
setTotalZapAmount={setTotalZappedAmount}
|
||||||
|
setHasZapped={setHasZapped}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user