From 9287822c64f747b3d19f784070a812c51e5ea14b Mon Sep 17 00:00:00 2001 From: en Date: Thu, 30 Jan 2025 18:01:37 +0100 Subject: [PATCH 1/2] fix(zaps): zap split UX Closes #140 --- src/components/Zap.tsx | 76 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/src/components/Zap.tsx b/src/components/Zap.tsx index 5a1fe9f..dfd1a74 100644 --- a/src/components/Zap.tsx +++ b/src/components/Zap.tsx @@ -2,6 +2,7 @@ import { getRelayListForUser } from '@nostr-dev-kit/ndk' import { QRCodeSVG } from 'qrcode.react' import React, { Dispatch, + PropsWithChildren, ReactNode, SetStateAction, useCallback, @@ -135,8 +136,9 @@ export const ZapQR = React.memo( handleClose, handleQRExpiry, setTotalZapAmount, - setHasZapped - }: ZapQRProps) => { + setHasZapped, + children + }: PropsWithChildren) => { const { ndk } = useNDKContext() useDidMount(() => { @@ -176,13 +178,22 @@ export const ZapQR = React.memo( } return ( -
+
) } @@ -749,6 +761,56 @@ export const ZapSplit = ({ if (!invoices) return null const authorInvoice = invoices.get('author') + const feedback = (isFirst: boolean) => ( +
+
+ + + + 1st Invoice +
+
+ + + + 2nd Invoice +
+
+ ) if (authorInvoice) { return ( removeInvoice('author')} setTotalZapAmount={setTotalZapAmount} setHasZapped={setHasZapped} - /> + > + {feedback(true)} + ) } @@ -773,7 +837,9 @@ export const ZapSplit = ({ handleClose() }} handleQRExpiry={() => removeInvoice('admin')} - /> + > + {feedback(false)} + ) } -- 2.34.1 From c1b4dac5a38349b6dccc8267c75b4f46403e7953 Mon Sep 17 00:00:00 2001 From: en Date: Thu, 30 Jan 2025 18:21:55 +0100 Subject: [PATCH 2/2] feat(zaps): show profile image on qr if available --- src/components/Zap.tsx | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/components/Zap.tsx b/src/components/Zap.tsx index dfd1a74..376397c 100644 --- a/src/components/Zap.tsx +++ b/src/components/Zap.tsx @@ -128,6 +128,7 @@ type ZapQRProps = { handleQRExpiry: () => void setTotalZapAmount?: Dispatch> setHasZapped?: Dispatch> + profileImage?: string } export const ZapQR = React.memo( @@ -137,6 +138,7 @@ export const ZapQR = React.memo( handleQRExpiry, setTotalZapAmount, setHasZapped, + profileImage, children }: PropsWithChildren) => { const { ndk } = useNDKContext() @@ -188,13 +190,22 @@ export const ZapQR = React.memo( value={paymentRequest.pr} height={235} width={235} - imageSettings={{ - src: 'https://m.primal.net/JPWc.png', - height: 35, - width: 35, - excavate: false - }} /> + {profileImage && ( +
+ Profile Avatar +
+ )}