diff --git a/src/components/WindowRenderer.tsx b/src/components/WindowRenderer.tsx index 6d1bc6b..22378c6 100644 --- a/src/components/WindowRenderer.tsx +++ b/src/components/WindowRenderer.tsx @@ -234,6 +234,7 @@ export function WindowRenderer({ window, onClose }: WindowRendererProps) { ); break; diff --git a/src/components/ZapWindow.tsx b/src/components/ZapWindow.tsx index 4ec6ead..e45d8a6 100644 --- a/src/components/ZapWindow.tsx +++ b/src/components/ZapWindow.tsx @@ -54,6 +54,8 @@ export interface ZapWindowProps { recipientPubkey: string; /** Optional event being zapped (adds context) */ eventPointer?: EventPointer | AddressPointer; + /** Callback to close the window */ + onClose?: () => void; } // Default preset amounts in sats @@ -79,6 +81,7 @@ function formatAmount(amount: number): string { export function ZapWindow({ recipientPubkey: initialRecipientPubkey, eventPointer, + onClose, }: ZapWindowProps) { // Load event if we have a pointer and no recipient pubkey (derive from event author) const event = use$(() => { @@ -345,6 +348,12 @@ export function ZapWindow({ if (invoiceResponse.successAction?.message) { toast.info(invoiceResponse.successAction.message); } + + // Close the window after successful zap + if (onClose) { + // Small delay to let the user see the success toast + setTimeout(() => onClose(), 1500); + } } else { // Show QR code and invoice const qrUrl = await generateQrCode(invoiceText);