diff --git a/src/components/ProfileViewer.tsx b/src/components/ProfileViewer.tsx index 270dad9..f607b82 100644 --- a/src/components/ProfileViewer.tsx +++ b/src/components/ProfileViewer.tsx @@ -441,20 +441,18 @@ export function ProfileViewer({ pubkey }: ProfileViewerProps) {
Lightning Address
-
- + -
+ )} diff --git a/src/components/ZapWindow.tsx b/src/components/ZapWindow.tsx index 231f3da..b1ea8da 100644 --- a/src/components/ZapWindow.tsx +++ b/src/components/ZapWindow.tsx @@ -24,13 +24,6 @@ import { } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; import { Label } from "@/components/ui/label"; import QRCode from "qrcode"; import { useProfile } from "@/hooks/useProfile"; @@ -48,6 +41,12 @@ import { import { useEmojiSearch } from "@/hooks/useEmojiSearch"; import { useProfileSearch } from "@/hooks/useProfileSearch"; import LoginDialog from "./nostr/LoginDialog"; +import { resolveLightningAddress, validateZapSupport } from "@/lib/lnurl"; +import { + createZapRequest, + serializeZapRequest, +} from "@/lib/create-zap-request"; +import { fetchInvoiceFromCallback } from "@/lib/lnurl"; export interface ZapWindowProps { /** Recipient pubkey (who receives the zap) */ @@ -234,8 +233,6 @@ export function ZapWindow({ let lnurlData; if (lud16) { - const { resolveLightningAddress, validateZapSupport } = - await import("@/lib/lnurl"); lnurlData = await resolveLightningAddress(lud16); validateZapSupport(lnurlData); } else if (lud06) { @@ -281,8 +278,6 @@ export function ZapWindow({ // Step 3: Create and sign zap request event (kind 9734) toast.info("Creating zap request..."); - const { createZapRequest, serializeZapRequest } = - await import("@/lib/create-zap-request"); const zapRequest = await createZapRequest({ recipientPubkey, @@ -297,7 +292,6 @@ export function ZapWindow({ // Step 4: Fetch invoice from LNURL callback toast.info("Fetching invoice..."); - const { fetchInvoiceFromCallback } = await import("@/lib/lnurl"); const invoiceResponse = await fetchInvoiceFromCallback( lnurlData.callback, @@ -324,9 +318,7 @@ export function ZapWindow({ await refreshBalance(); setIsPaid(true); - toast.success( - `⚡ Zapped ${amount} sats to ${recipientProfile?.name || recipientName}!`, - ); + toast.success(`⚡ Zapped ${amount} sats to ${recipientName}!`); // Show success message from LNURL service if available if (invoiceResponse.successAction?.message) { @@ -427,190 +419,215 @@ export function ZapWindow({
- {/* Show event preview if zapping an event */} - {event && } + {/* Show QR Code View if invoice exists */} + {showQrDialog ? ( +
+ {/* Header */} +
+
+ Zap {recipientName} +
+
+ Scan with your Lightning wallet or copy the invoice +
+
- {/* Amount Selection */} -
- {/* Preset amounts - single row */} -
- {availableAmounts.map((amount) => ( + {/* QR Code */} + {qrCodeUrl && ( +
+ Lightning Invoice QR Code +
+ )} + + {/* Invoice */} +
+ +
+ + +
+
+ + {/* Actions */} +
+ +
+ + {/* Retry with wallet button if payment timed out */} + {paymentTimedOut && + wallet && + walletInfo?.methods.includes("pay_invoice") && ( + + )} +
+ ) : ( + <> + {/* Show event preview if zapping an event */} + {event && } + + {/* Show recipient info if not zapping an event */} + {!event && ( +
+
{recipientName}
+ {recipientProfile?.lud16 && ( +
+ {recipientProfile.lud16} +
+ )} +
+ )} + + {/* Amount Selection */} +
+ {/* Preset amounts - single row */} +
+ {availableAmounts.map((amount) => ( + + ))} + {/* Custom amount inline */} + { + setCustomAmount(e.target.value); + setSelectedAmount(null); + }} + min="1" + className="flex-1 h-9" + /> +
+ + {/* Comment with emoji support - single row */} + +
+ + {/* Payment Button */} + {!canSign ? ( + + ) : ( + - ))} - {/* Custom amount inline */} - { - setCustomAmount(e.target.value); - setSelectedAmount(null); - }} - min="1" - className="flex-1 h-9" - /> -
- - {/* Comment with emoji support - single row */} - -
- - {/* Payment Button */} - {!canSign ? ( - - ) : ( - + )}
{/* Login Dialog */} - - {/* QR Code Dialog */} - - - - Lightning Invoice - - Scan with your Lightning wallet or copy the invoice - - - -
- {qrCodeUrl && ( -
- Lightning Invoice QR Code -
- )} - -
- -
- - -
-
- -
- - -
- - {/* Retry with wallet button if payment timed out */} - {paymentTimedOut && - wallet && - walletInfo?.methods.includes("pay_invoice") && ( - - )} -
-
-
); }