diff --git a/src/components/wallet/CashuWallet.tsx b/src/components/wallet/CashuWallet.tsx index 82a89c3..17f4bfd 100644 --- a/src/components/wallet/CashuWallet.tsx +++ b/src/components/wallet/CashuWallet.tsx @@ -45,7 +45,7 @@ export function CashuWallet() { const { user } = useCurrentUser(); const { getInvoice: getLightningInvoice, isLoading: isResolvingAddress } = useLightningAddress(); const { toast } = useToast(); - const { generateQRCode, isScanning, startScanning, stopScanning, error: qrError, classifyQRCode } = useQRCode(); + const { generateQRCode, isScanning, startScanning, stopScanning, error: qrError, classifyQRCode, setModalOpen } = useQRCode(); const { copy: copyToClipboard } = useCopyToClipboard(); const { hasNsecAccess } = useNsecAccess(); @@ -336,12 +336,14 @@ export function CashuWallet() { // Start/stop QR scanner when modal opens/closes useEffect(() => { if (showQRScanner) { + setModalOpen?.(true); startScanning(handleQRScanResult); } else { + setModalOpen?.(false); stopScanning(); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [showQRScanner, startScanning, stopScanning]); + }, [showQRScanner, startScanning, stopScanning, setModalOpen]); // ============================================================================ // EFFECTS - Cleanup diff --git a/src/components/wallet/WalletModals.tsx b/src/components/wallet/WalletModals.tsx index dd5e528..477fcce 100644 --- a/src/components/wallet/WalletModals.tsx +++ b/src/components/wallet/WalletModals.tsx @@ -3,7 +3,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/com import { Badge } from '@/components/ui/badge'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; -import { X, Coins, AlertTriangle, RefreshCw, Key, ArrowRightLeft, Loader2 } from 'lucide-react'; +import { X, Coins, AlertTriangle, RefreshCw, Key, ArrowRightLeft, Loader2, Clipboard } from 'lucide-react'; import { QRModal } from '@/components/ui/qr-modal'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { nip19 } from 'nostr-tools'; @@ -487,51 +487,47 @@ export function WalletModals({ )} {/* QR Scanner Modal */} - { + { if (!open) { setShowQRScanner(false); - stopScanning(); + await stopScanning(); } }}> - - {/* Camera view with rounded corners */} -
+ + {/* Header */} + + + - {/* Error message */} - {qrError && ( -
- {qrError} -
- )} + {/* Camera container with square aspect ratio */} +
+
+ + {/* Scanning area overlay frame */} + {/*
+
+
*/} + + {/* Error message */} + {qrError && ( +
+ {qrError} +
+ )} +
{/* Paste Button */} -
+